Jump to content

Permanently moved Page help


lukep11a

Recommended Posts

Hi, I had a page, team-info.php?team_id=48 for example and some of these pages have been indexed by google, I then decided to move team-info.php into a folder named team and use my .htaccess file to rewrite the links to team/48 meaning some of the results in google now link to an error page. I have tried to direct the old links to the new links but it doesn't seem to be working, here's my code:

 

Rewrite rule that currently works to point dynamic link to a clean URL:

 

RewriteRule ^team/([0-9]+)$ team/team-info.php?team_id=$1

 

 

Rewrite rule to move the old dynamic link to the new one, that is not currently working:

RewriteRule ^team-info.php?team_id=([0-9]+)$ team/$1 [R=301,L]

 

If anyone can help me on this then I would be very grateful, i've been trying different solutions out for a while now and not getting anywhere, thanks.

Link to comment
Share on other sites

The path used by RewriteRule does not include the query string.  You have to test that in a RewriteCond directive.

RewriteCond %{QUERY_STRING} team_id=([0-9]+)
RewriteRule ^team-info.php$ team/%1 [R=301,L]

 

I believe that would be what you want.

Link to comment
Share on other sites

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.