Perad Posted March 25, 2009 Share Posted March 25, 2009 I am redeveloping a site and the client wants to keep the link structure. The link structure is bad and I am strugling to rewrite it. If someone could help me with this first one I should be able to rewrite the rest of them. This is the URL. http://localhost/iraqidinars/iraqidinars/newiraqidinars.html I need the server to redirect requests for this file to... http://localhost/iraqidinars/index.php?page/1 I tried adding this line RewriteRule ^iraqidinars/newiraqidinars\.html$ iraqidinars/index.php?site/show/1 However this generates an error. Does anyone have any ideas on how to solve this? Link to comment https://forums.phpfreaks.com/topic/151070-help-rewriting-this-page/ Share on other sites More sharing options...
POG1 Posted March 25, 2009 Share Posted March 25, 2009 Why would you want to make a nice URL into a not nice URL? Link to comment https://forums.phpfreaks.com/topic/151070-help-rewriting-this-page/#findComment-793680 Share on other sites More sharing options...
Perad Posted March 25, 2009 Author Share Posted March 25, 2009 To be honest, the url should be like this. sitename.com/pagename/ However, I have been told that I must, MUST keep existing url's. I have no choice on this matter, this is despite my best arguing. All I want to do is this. When someone goes to this page. http://localhost/iraqidinars/iraqidinars/newiraqidinars.html The URL should show the above. However the server needs to show this page. http://localhost/iraqidinars/index.php?page/1 I thought that this was what mod_rewrite was for. To make sitename.com/page into sitename.com/index.php?page=... All I want to do is make a php page display when a html page is called. I hope that makes sense. Link to comment https://forums.phpfreaks.com/topic/151070-help-rewriting-this-page/#findComment-793706 Share on other sites More sharing options...
POG1 Posted March 25, 2009 Share Posted March 25, 2009 I'm sure you will be doing it with a quite a few URLs do try something like this.. RewriteRule ^/([a-zA-Z]+)/([a-zA-Z]+)\.html$ /index.php?site=$1&page=$2 [L] I'm not very good with regular expressions but if it works as i think it will then you could have something like; iraqidinars/newiraqidinars.html and it would go to; index.php?site=iraqidinars&page=newiraqidinars Link to comment https://forums.phpfreaks.com/topic/151070-help-rewriting-this-page/#findComment-793712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.