ergesa Posted November 15, 2012 Share Posted November 15, 2012 Hi, I'm trying to redirect old urls of my old web site to new urls to my new web site. There ara several urls to redirect and I need to redirect them one to one. My old url is: http://www.oldsite.com/index.php?page=old-address And the new url is: http://www.newsite.com/new-adress I tried this; RewriteEngine On RewriteBase / redirect 301 /index.php?page=old-address http://www.newsite.com/new-adress And this; RewriteEngine On RewriteBase / redirect 301 /index.php%3Fpage=old-address http://www.newsite.com/new-adress but it didn't work. Do you have any idea to help me? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/270727-htaccess-301-redirect-help/ Share on other sites More sharing options...
txmedic03 Posted November 24, 2012 Share Posted November 24, 2012 I don't think you need the 301. If I'm not mistaken you can do Redirect old_url new_url Quote Link to comment https://forums.phpfreaks.com/topic/270727-htaccess-301-redirect-help/#findComment-1394689 Share on other sites More sharing options...
requinix Posted November 24, 2012 Share Posted November 24, 2012 I'm not sure Redirect will look at the query string, and that doesn't seem to be documented. If that's the case then you do need mod_rewrite. RewriteCond %{QUERY_STRING} =page=old-address RewriteRule ^/?index\.php$ http://www.newsite.com/new-adress [L,R=301] Also, Redirect is part of mod_alias. If you use it then you don't need a RewriteEngine or a RewriteBase. Completely different mechanisms. Quote Link to comment https://forums.phpfreaks.com/topic/270727-htaccess-301-redirect-help/#findComment-1394693 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.