Jump to content

mod_rewrite, where to start


dazzclub

Recommended Posts

Hello all,

 

I have a site im working and it has some urls that i would to give a make over.

 

one url is http://www.colourchange.com/thermometers.php?products=thermometers

 

I would like to turn this into http://www.colourchange.com/thermometers/room/

 

Here is what i have so far in my .htaccess file

RewriteEngine on
RewriteRule ^/(.*)/(.*)/thermometers.php?products=thermometers$ http://www.colourchange.com/thermometers/room/

 

I am currently running this locally, so when i can do it i can then make the neccessary changes to the live site.

 

Thanks, any help or tips would be nice.

 

Dazzclub

Link to comment
https://forums.phpfreaks.com/topic/166304-mod_rewrite-where-to-start/
Share on other sites

You have your rule completely around the wrong way.

 

You want to write...

 

http://www.colourchange.com/thermometers/room/

 

to

 

/thermometers.php?products=thermometers

 

if this is the exact rule you wish to rewrite its simple.

 

RewriteEngine on
RewriteRule ^/thermometers/room$ thermometers.php?products=thermometers

 

Most people however will want to make there rules more dynamic in nature.

Hi there,

 

Thanks for your reply and your help.

 

Let me just confirm things, the orginal url is http://www.colourchange.com/thermometers.php?products=thermometers but if possible turn it into http://www.colourchange.com/thermometers.php/products/thermometers or just http://www.colourchange.com/thermometers.php/products/

 

As it stands, i only have a few urls that need changing like this.

 

Is this possible?

 

Thanks for your help. :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.