Forum Moderators: phranque

Message Too Old, No Replies

SEO - Google killing my site because of URL rewrite?

         

Buster13

3:11 pm on Nov 29, 2009 (gmt 0)

10+ Year Member



2 weeks ago, I had re-code my 1 year old website from dynamic to static URLs.
now when I google my web site example.com, the search results are half dynamic and half static for different webpages

for eg, google-ing "example tshirts"

example.com/shop/mens/t-shirts/44/1185/ (new static URL Ok)
example.com/shop/index.php?c=44 (should have been example.com/shop/t-shirts/)

The above are not similar web pages meaning they are NOT duplicate contents, however my concern is, my website is already 100% rewrite static URLs, but after 2 weeks, why google only update half half?

Btw, my web traffic dropped like 30% last week T.T
(not sure if this is due to i redirect to 404 for all old invalid dynamic URLs)

I also want to mention, i used sitemap software and crawl my website, and the NEW sitemap.xml does NOT contain any dynamic URLs. (in case, someone suspects i did not re-code my URLs correctly ;p)

[edited by: jdMorgan at 1:22 pm (utc) on Nov. 30, 2009]
[edit reason] example.com [/edit]

g1smd

1:55 pm on Dec 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That, or something very much like it should work.

Send the 404 header, then the error message.

Make sure that happens for all four options.

Buster13

2:46 pm on Dec 3, 2009 (gmt 0)

10+ Year Member



problem solved once i used Jim method of require_once '404.php';

a minor problem still occurs when, a user enters
http://example.net/shop/9999/99999/

HTTP headers captures show "301 Moved Permanently" caused by missing (www)
becomes
http://www.example.net/shop/9999/99999/
show "404 Not Found"

---
user enters
[(www).example.net...] is alright
immediately served "404 Not Found"

correct me if i'm wrong, but i don't think this is going to be a major setback for SEO right, consider that this is done solely for a 404 PHP. And what are the chances that someone will enter without (www).

g1smd

3:03 pm on Dec 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am not too worried about the non-www to www redirect (for identical URL path part in both of the URLs) finally leading to a 404 error status when the www version is requested.

Technically, the non-www should directly serve that 404 status code, but it gets too complicated to fix every possible permutation once you have some redirects being handled by scripts and others by .htaccess rules.

Just make sure that nothing inside your site links to any non-www URLs.

jdMorgan

3:55 pm on Dec 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The check for whether the requested URL, after being rewritten from static to dynamic, can be used to generate valid content should be done before the www redirect if possible.

Given the length and accumulated complexity of this thread, I'm not sure, but I think this should be done in your main script, not in redirect.php.

Jim

Buster13

2:27 am on Dec 4, 2009 (gmt 0)

10+ Year Member



g1smd:
[Just make sure that nothing inside your site links to any non-www URLs.]

yes i double check by running xml-sitemap to generate sitemap.xml on my website. discover 1 URL using http://example.net/... and i had since corrected it to (www)

Jim:
[can be used to generate valid content should be done before the www redirect if possible.]

i 'roughly' get what you mean above but i just can't think the right means to it. my main script take in value 999999 as invalid parameter for $c and SQL search return NULL rows and i throw require 'custom 404.php' (is that simple)

---
anyway, at the end of day, i have achieved much to my htaccess with the help from both you guys. yes, my traffic is slowly recovering and my Google URL links are changing faster after I code dynamic to static (as well)

things are finally looking bright n sunny at the end of the tunnel ! ;p

jdMorgan

3:47 pm on Dec 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here' some pseudo-code to illustrate the logic:

incoming request received, control passed to mod_rewrite code
rewrite the request to your script
look up query string variables in database
if query is valid
. check requested hostname
. if canonical
.. serve content
. endif canonical
. elsif non-canonical
.. invoke 301 redirect to canonical domain
. endif non-canonical
elsif query is invalid
. serve 404-Not Found (with links only to canonical URLs in custom
. error document), or 301 redirect to correct URL if applicable
endif query is invalid
exit

Jim
This 36 message thread spans 2 pages: 36