Jump to content

mod_rewrite...static or dynamic rule


dazzclub

Recommended Posts

Hi guys,

 

With the help of a user called thorpe he was able to rerwrite a rule i was after but i wanted to ask a few more questions.

 

As mentioned Thorpe wrote this for me

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

 

He also suggested that a more dynamic rule be used instead.

 

What I would like to do is when the users request thermometers.php?products=thermometers by pressing a link the user would then see thermometers/room/in the browser instead.

 

For this to work would i then need to create the actual folders on my server? i.e thermometers/room/?

 

Can someone point me in the right direction as what would be best please.

 

Thanks for your help.

 

Regards

Dazzclub

Link to comment
https://forums.phpfreaks.com/topic/167111-mod_rewritestatic-or-dynamic-rule/
Share on other sites

For this to work would i then need to create the actual folders on my server? i.e thermometers/room/?

 

No that how rewrite works...its a fake url - dosnt exist

You dont need a forward slash for the fake url

 

RewriteEngine on
RewriteRule ^ (.*)/room thermometers.php?products=$1

 

So your link will be <a href="/thermometers/room">

Hi Dreamwest,

 

Thanks for getting back to me on this...

 

I have just uploaded .htaccess file and i have tested the url http://www.colourchange.com/thermometers/room it displays the correct page but without any of the css styling attached...It should remsemble this page http://www.colourchange.com/thermometers.php?products=thermometers&type=room Should I do anything differently??

 

 

With the new url /thermometers/room, would I then replace the old one by editing the actual xhtml file. As the link doesnt seem to change when i use it, it still displays the old one.

 

Thanks for your help on this, i know im asking too much but I'm so lost.

 

 

Thanks

Darren

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.