dazzclub Posted July 23, 2009 Share Posted July 23, 2009 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 More sharing options...
dreamwest Posted July 24, 2009 Share Posted July 24, 2009 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 https://forums.phpfreaks.com/topic/167111-mod_rewritestatic-or-dynamic-rule/#findComment-881641 Share on other sites More sharing options...
dazzclub Posted July 24, 2009 Author Share Posted July 24, 2009 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 https://forums.phpfreaks.com/topic/167111-mod_rewritestatic-or-dynamic-rule/#findComment-881848 Share on other sites More sharing options...
dreamwest Posted July 24, 2009 Share Posted July 24, 2009 Common problem. You need to have a root comand on all you includes "/", that includes pictures too so in css just add /style.css instead of style.css Link to comment https://forums.phpfreaks.com/topic/167111-mod_rewritestatic-or-dynamic-rule/#findComment-882394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.