Jump to content

Htaccess 301 Redirect Help


ergesa

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/270727-htaccess-301-redirect-help/
Share on other sites

  • 2 weeks later...

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.

Archived

This topic is now archived and is closed to further replies.

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