View Full Version : about url rewrite
itsmani1
03-18-2005, 02:40 AM
these regular expressions are not doing any thing for me.
here is some explanation!!!!!!!
@ root dir i have pages like:
index.php, search.php, etc
Folder of css
Folder of images
Folder of uploads
Problem:::
css files on index and all the pages are coming form css folder
some of the images are coming form images folder and rest are coming
from uploads.
what i have to do is :::::
i have to rewrite urls
http://domain.com/posters/index.php?pag=news
http://domain.com/posters/index.php?pag=news1
http://domain.com/posters/index.php?pag=about
to
http://domain.com/posters/pag/news
http://domain.com/posters/pag/news1
http://domain.com/posters/pag/about
Muhammad Abdul Mannan
http://mannan.zabvision.edu.pk
http://itsmani1.sphosting.com
SEO Aaron
03-18-2005, 12:10 PM
I am no expert on this but you could try a rewrite rule such as:
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?$1=$2 [L]
This Seems to work to make:
http://domain.com/posters/index.php?pag=news
into:
http://domain.com/posters/pag/news
If that is what you want.
Aaron :eyes:
sarahk
03-19-2005, 12:11 AM
Don't mess with your rewrite, it's probably ok
in your links to the images and css give this notation
<link rel="stylesheet" type="text/css" href="/css/layout.css"/>
where you have a / at the beginning. This tells the server that it's not a relative link but coming from the domain root. It doesn't matter where your page is, it will always look for your css, image, wav file in the same place.
Sarah
itsmani1
03-21-2005, 04:20 AM
problem to me is:
it shows link in url bar like this:
http://www.artologics.com/posters/index.php?pag=aboutus
but it should show like this::
http://www.artologics.com/posters/pag/aboutus
one more thing is this.....
when i write
http://www.artologics.com/posters/pag/aboutus
in url bar it works fine gives good result but then changes url to
http://www.artologics.com/posters/index.php?pag=aboutus
why?????????
Muhammad Abdul Mannan
http://mannan.zabvision.edu.pk
http://itsmani1.sphosting.com
itsman1@hotmail.com
SEO Aaron
03-22-2005, 10:08 AM
Are You Using mod_rewrite? If so..then can I see your rule? I'm not sure that I fully understand.
Aaron
itsmani1
03-22-2005, 09:46 PM
ys sure why not?????
here is code::::
RewriteEngine on
RewriteRule ^catid/([0-9]+).html$ /posters/index.php?catid=$1 [R]
ReWriteRule ^pag/([a-z]+).html$ /posters/index.php?pag=$1 [R]
ReWriteRule ^pag/css/([a-z]+.[a-z]+)$ /posters/css/$1 [R]
ReWriteRule ^pag/images/([a-z]+_[0-9]+.jpg)$ /posters/images/$1 [R]
ReWriteRule ^/catid/uploads/([a-z]+.jpg)$ /posters/uploads/$1 [R]
ReWriteRule ^catid/css/([a-z]+.[a-z]+)$ /posters/css/$1 [R]
ReWriteRule ^catid/images/([a-z]+_[0-9]+.jpg)$ /posters/images/$1 [R]
ReWriteRule ^/catid/uploads/([a-z]+.jpg)$ /posters/uploads/$1 [R]
RewriteRule ^subcat/([0-9]+).html$ /posters/index.php?catid=$1 [R]
ReWriteRule ^subcat/css/([a-z]+.[a-z]+)$ /posters/css/$1 [R]
ReWriteRule ^subcat/images/([a-z]+_[0-9]+.jpg)$ /posters/images/$1 [R]
ReWriteRule ^/subcat/uploads/([a-z]+.jpg)$ /posters/uploads/$1 [R]
Muhammad Abdul Mannan
http://mannan.zabvision.edu.pk
http://itsmani1.sphosting.com
itsmani@gmail.com
itsmani1@hotmail.com
SEO Aaron
03-30-2005, 10:52 AM
I am sorry I cannot help with that, maybe someone could see why this rule
RewriteRule ^([a-zA-Z_-]+)\.php$ /project_test/index.php?id=$1 [L]
Is Giving me an internal server error. I suspect the problem lies in the \.php$ area of the rule :-)
Thanks.
cvele
04-01-2005, 07:34 AM
Try :
RewriteRule ^([A-Za-z0-9\+\-]*).* project_test/index.php?id=$1 [L,NC]
vBulletin v3.0.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.