Forum Moderators: phranque
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]
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).
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.
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
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
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