Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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