mod_rewrite and SEO
Moderator: General Moderators
-
intellivision
- Forum Commoner
- Posts: 83
- Joined: Mon Aug 22, 2005 1:25 am
- Location: Orbit
mod_rewrite and SEO
For months I had pages like
domain.com/page?p=1&q=2
that got indexed by Google and the other engines.
Then with the help of fine folks on this forum I mod_rewrite(d) them to
domain.com/page/p/1/q/2
Even better. But...
Question: now the engines will see duplicate content, yes?
If so, should I implement 301 (SEO-friendly) redirects of the original pages to the new urls?
If so, how? Am I overanalyzing this?
TIA
domain.com/page?p=1&q=2
that got indexed by Google and the other engines.
Then with the help of fine folks on this forum I mod_rewrite(d) them to
domain.com/page/p/1/q/2
Even better. But...
Question: now the engines will see duplicate content, yes?
If so, should I implement 301 (SEO-friendly) redirects of the original pages to the new urls?
If so, how? Am I overanalyzing this?
TIA
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: mod_rewrite and SEO
You mean the search engines will see ?p=1&q=2 as well as /p/1/q/2 ?intellivision wrote:For months I had pages like
domain.com/page?p=1&q=2
that got indexed by Google and the other engines.
Then with the help of fine folks on this forum I mod_rewrite(d) them to
domain.com/page/p/1/q/2
Even better. But...
Question: now the engines will see duplicate content, yes?
If so, should I implement 301 (SEO-friendly) redirects of the original pages to the new urls?
If so, how? Am I overanalyzing this?
TIA
Providing you correctly updated the links on the website to point to the new URLs this shouldn;t happen since the engines will have nothing to spider the old style URLs. Eventually the old links will disappear from the search engines
I'd say otherwise, if the search engines can still see the old pages (it already knows the URLs) it will keep them in the index. In your mod_rewrite add another GET variable like rewrite=1, if that variable is not there on the page then do a header redirect, googlebot should see the redirect and drop the old url eventually
-
intellivision
- Forum Commoner
- Posts: 83
- Joined: Mon Aug 22, 2005 1:25 am
- Location: Orbit
And call up google and tell them to change the URL in their database to include this flag for you? No.intellivision wrote:Could I do it the other way around, where the old querystring gets the additional name-value pair?
Also it is not defeating the purpose of mod_rewrite at all. The URL your users see is independant of a flag that you set on the GET string internally..
-
intellivision
- Forum Commoner
- Posts: 83
- Joined: Mon Aug 22, 2005 1:25 am
- Location: Orbit
Instead of
rewriteRule /test/([0-9]+) test.php?id=$1
do
rewriteRule /test/([0-9]+) test.php?id=$1&flag=1
Then in test.php
rewriteRule /test/([0-9]+) test.php?id=$1
do
rewriteRule /test/([0-9]+) test.php?id=$1&flag=1
Then in test.php
Code: Select all
if (!$_GET['flag']) {
header('Location:/test/'.(int)$_GET['id']);
exit();
}-
intellivision
- Forum Commoner
- Posts: 83
- Joined: Mon Aug 22, 2005 1:25 am
- Location: Orbit
Excellent, thank you, it worked.
I'm going to add one thing when I get home to make it perfect:
before header('Location...
because without that line you'll get a non-spider-friendly 302 redirect: HTTP Status Code: HTTP/1.1 302
You may check your redirects with this:
http://www.seoconsultants.com/tools/headers.asp
I'm going to add one thing when I get home to make it perfect:
Code: Select all
header("HTTP/1.1 301 Moved Permanently");because without that line you'll get a non-spider-friendly 302 redirect: HTTP Status Code: HTTP/1.1 302
You may check your redirects with this:
http://www.seoconsultants.com/tools/headers.asp