Clean URL
#1
Posted 11 August 2006 - 08:35 AM
http://www.pixel2lif...arch/all/sig/1/
instead of having something like:
http://www.pixel2life.com/index.php?search...=all&page=1
#2
Posted 11 August 2006 - 08:51 AM
The sitepoint article is quite helpful. http://www.sitepoint...e-url-rewriting
Edited by .Matt, 11 August 2006 - 08:52 AM.
#3
Posted 11 August 2006 - 09:16 AM
#4
Posted 11 August 2006 - 10:54 AM
#5
Posted 12 August 2006 - 08:16 AM
#6
Posted 12 August 2006 - 09:51 AM
Matt
#7
Posted 12 August 2006 - 10:03 AM
deadly, on Aug 12 2006, 02:50 PM, said:
Matt
weird.
I've never had a problem with it.
Do you have any sort of firewall of some sort on at all?
still odd though, as I have Norton Internet Security on and it works.
Edited by SpatialVisionary, 12 August 2006 - 10:04 AM.
#8
Posted 12 August 2006 - 07:52 PM
/**
* handle.php
*/
$parts = preg_split('~/~', $_GET['path'], -1, PREG_SPLIT_NO_EMPTY);
if(isset($parts[0])) ? include_once($parts[0]) : include_once('index.php');
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ handle.php?path=$1 [QSA,L]
</IfModule>
Something like that... That may or may bot be exactly what you want.
#9
Posted 26 August 2006 - 08:46 PM
eg. /css/images/image.gif
should be: http://www.url.com/c...mages/image.gif
but with mod_rewrite i get: http://www.url.com/h...mages/image.gif
This is my rewrite rule:
RewriteEngine On
RewriteRule (.*)/$ /skins/index.php?do=$1
#10
Posted 26 August 2006 - 08:56 PM
RewriteEngine On RewriteRule ^(.*)/$ /skins/index.php?do=$1 [nc]
#12
Posted 26 August 2006 - 09:55 PM
#13
Posted 26 August 2006 - 10:05 PM
i had my links as css/images/image.gif for example but they needed to be /skins/css/images/image.gif works good now thanks for your help anyway
one other thing say one of my pages has an extra parameter so $id=something but all the rest dont so for example:
Pages with 1 param:
http://www.url.com/index.php?do=home --> http://www.url.com/home/
http://www.url.com/i...hp?do=tutorials --> http://www.url.com/tutorials/
Page with 2 params:
http://www.url.com/i...p?do=skins&id=1 --> http://www.url.com/skins/1/
With the following rewrite rule only the page with 2 params worked correctly:
RewriteEngine On RewriteRule ^(.*)/(.*)/$ /skins/index.php?do=$1&id=$2 [nc]
And of course with the rewrite rule below only the pages with 1 param worked:
RewriteEngine On RewriteRule ^(.*)/$ /skins/index.php?do=$1 [nc]
How do i go about having 1 rule to fit both situations if thats possible?
Edited by BlazeForc3, 27 August 2006 - 12:00 AM.
#14
Posted 27 August 2006 - 12:05 AM
RewriteEngine On RewriteRule ^(.*)/(.*)/$ /skins/index.php?do=$1&id=$2 [nc] RewriteRule ^(.*)/$ /skins/index.php?do=$1 [nc]
Always have the rules with the most params first, other wise you will get 404 errors and the whatnot.
Edited by Demonslay, 27 August 2006 - 12:05 AM.
#15
Posted 14 November 2006 - 10:57 AM
I had made a topic before, and i've done everything right, but mod_rewrite just won't work for me.
I get a SQL error with it. So tell me, if I have something that has a relative link back to something and I use mod rewrite and it changes the link to news/1/2.html would this confilct with what I have for the relative link, and would it possibly be the reason for the SQL error. (I'll post the error when I get out of school if it'd be helpful)
Thanks
#16
Posted 14 November 2006 - 02:12 PM
#17
Posted 14 November 2006 - 11:35 PM
that is the error
#18
Posted 15 November 2006 - 03:08 PM
Are you getting this error when you access the script with the usual way, of using the long URL (site.com/page.php?var=1&id=2...). If not, then you are probably not passing the variables correctly, or are giving invalid values.
Show us the exact links, both longated, and relative, and we can compare the two and see why it is giving the 'news/' to the LIMIT (I assume).
I also suspect you may be doubling your variables. For instance, if you have your index page grabbing the 'id' to include a page, and you are adding an 'id' for the news article, they will conflict and you will get some contrasting results.
#19
Posted 15 November 2006 - 03:38 PM
I know 'nc' is basially non-case-sensitive, so something like 'site.com/example/1' and 'site.com/Example/1' will both still work the same.
Edited by Demonslay, 15 November 2006 - 03:39 PM.
#20
Posted 15 November 2006 - 07:04 PM
Demonslay, on Nov 15 2006, 12:08 PM, said:
Are you getting this error when you access the script with the usual way, of using the long URL (site.com/page.php?var=1&id=2...). If not, then you are probably not passing the variables correctly, or are giving invalid values.
Show us the exact links, both longated, and relative, and we can compare the two and see why it is giving the 'news/' to the LIMIT (I assume).
I also suspect you may be doubling your variables. For instance, if you have your index page grabbing the 'id' to include a page, and you are adding an 'id' for the news article, they will conflict and you will get some contrasting results.
http://punkbythebook.../news/1/22.html
Here are the links.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
