big-dev Posted October 15, 2010 Share Posted October 15, 2010 I am having trouble rewriting a url, I have taken on a project that to rebuild a site that is over 7 years old and the current url structure is "http://www.mysite.com/?page=home" this i find crazy who uses "?page=" anyway am now creating the site again using a better structure of http://www.mysite.com/home.htm my problem is that the owner of the site has good google results with the current urls but wants them changing, and for the old ones to work too, i am trying to do this with .htaccess but the "?" in the url is causing massive problems with internal server errors. can anyone help me please it driving me nuts. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/215965-url-rewrite/ Share on other sites More sharing options...
the182guy Posted October 15, 2010 Share Posted October 15, 2010 In regular expressions the question mark is a reserved character so you need to escape it like \? Quote Link to comment https://forums.phpfreaks.com/topic/215965-url-rewrite/#findComment-1122571 Share on other sites More sharing options...
phpfreak Posted October 16, 2010 Share Posted October 16, 2010 Do you have any code that handles the URL mapping or are you wanting to do this strictly via .htaccess / config file Quote Link to comment https://forums.phpfreaks.com/topic/215965-url-rewrite/#findComment-1122628 Share on other sites More sharing options...
big-dev Posted October 16, 2010 Author Share Posted October 16, 2010 I am trying to use the htacces route atm as i thought it'd be much quicker "not so" havent used url mapping before! this is my latest attept RewriteRule ^\?page=mypage$ mypage.htm$1 Quote Link to comment https://forums.phpfreaks.com/topic/215965-url-rewrite/#findComment-1122679 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.