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
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">

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.