Mod_rewrite help

software development

#1

hello, I’m trying to get pages like
http://www.rent-index.com/detailsCottages.php?postid=1493 to become
www.rent-index.com/1493 or at least www.rent-index.com/vacations/1493
I’ve tried reading this stuff on
http://wiki.dreamhost.com/index.php/Mod_rewrite but i can’t figure out
how to do this.
Can you please help :slight_smile:


#2

[quote]hello, I’m trying to get pages like
http://www.rent-index.com/detailsCottages.php?postid=1493 to become
www.rent-index.com/1493 or at least www.rent-index.com/vacations/1493[/quote]
My knowledge of mod_rewrite is pretty limited, but I think this will work:

RewriteEngine On RewriteRule ^vacations/([0-9-]+)/ /detailsCottages.php?postid=$1 [QSA]Remember that mod_rewrite doesn’t convert the old URL into the new URL. It does the opposite. If someone enters http://rent-index.com/vacations/1234/ it will be redirected to http://rent-index.com/detailsCottages.php?post=1234


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

hello, but instead of redirecting it, is it possible to make such a url www.rent-index.com/1321 in php ?


#4

oh ic, it redirects it but the url stays the same :slight_smile: thats what i want. thanx a lot for your help :slight_smile: