If for some reason on my website an error occurs, the page will return response 500 and as content it will show some information for the vistor about what happened and where he can continue.
For example:
/product/somebook -> Normal HTTP 200 OK with content about this book
When internal error happens:
/product/somebook -> Error HTTP 500 returns page with information about what to do now (no redirect)
If the reponse is 500 should the page contain a canonical tag to for example /error ?
An error page, such as 500 or 404 (assuming it is actually served with the appropriate HTTP status code), won't be indexed by a search engine, and no PageRank is attributed, so there's no need to apply a canonical link element to the error page.
Related
Problem: Detect status of page and redirect to another page or change the status code.
For example, I want to detect if the page has status 401, then and only then I want the status to be changed to 403. Or be redirected to a 403 page when I get a 401 page.
There seems to be tons of information online, but none that answers this question adequetly.
Your request is kind of odd from a http perspective, when you say "detect" that means you have already requested a resource and received a 401 response. So basically you should just show a custom error page for your needs.
You coult try:
ErrorDocument 401 /errors/error403page.html
My Question is regarding GCM URL and 302 redirect response.
When I do curl -v url = https://gcm-http.googleapis.com/gcm/send, I get a 302 response with a new URL populated in location header. My question is, why can't I use the new URL received in 302 redirect always? What is the reason for Google responding with 302 redirect? I would really appreciate detailed explanation.
Many Thanks,
Sushil
Based from this article, error 302 means "Resource temporarily located elsewhere according to the Location header." This seems to be a previously reported issue (with GCM):
https://groups.google.com/forum/#!topic/android-gcm/WwEg6buc-K0
IO Exception while accessing Google Cloud message?
Suggested action is to re-run the request to the provided (temporary, alternate) URL.
I just did an SEO test of my site http://www.photographyattic.com using seositecheckup.com. It flagged up pages with 404 errors
From 100 distinct anchor links analyzed, 72 of them seems to be broken.
These pages don't seem to be broken when I view with my browser. Example http://www.photographyattic.com/category-1
Any idea why this would be?
http://www.photographyattic.com/category-1 is sending HTTP status code 404. The page doesn’t have to be broken because of that, you can display whatever you like on 404 pages.
You should send the status code 200 instead.
I need to be able to redirect versions of a product that returns a 404 error in a query string url back to the main product URL for example
www.domain.com/product.html?id=234 - 200 ok
www.domain.com/product.html?id=236 - 404 error
Leave /product.html?id=234 as it is due to it returning a 200 status
Redirect /product.html?id=236 to /product.html as it returns a 404 status
Is this possible via the .htaccess??
There is a statement that you can put in the htaccess to check if not found and send user to specified 404 page I was unsure if this could be used as a query string
Sure, but that only checks if product.html exists. It doesn't actually run any scripts to verify that id=236 is valid or not. You need to make the change in your script, the place where it validates the id parameter. If it finds that the ID is a 404, then it needs to do the redirect from there.
The htaccess file can't help you here.
I have generated the Sitemap indexes for Google. The only issue which I have is that how to verify that all the indexes(URL's) which got generated work or not. Based on the guide it says something like this:
you write a script to test each URL in the sitemap against your application
server and confirm that each link returns an HTTP 200 (OK) code. Broken links may indicate a mismatch
between the URL formatting configuration of the Sitemap Generator
I just wanted to see if somebody had such experience on how to write such script?
google webmaster tools will report you within "site configuration -> sitemaps" any HTTP errors and redirects (pretty much everything that is not an HTTP 200), additionally in the "Diagnostics -> Crawl Errors -> in Sitemaps" is another view of errors that occured while crawling urls that were listed within the sitemaps.
if that is not what you want, i would just do some logfile grep-ing. (grep for "googlebot" and an identifier of the urls that you listed within your sitemaps)
you could propably write your own crawler to pre-check if your sites return an HTTP 200, but well, if it returns an HTTP 200 for you now, does not mean it will return an HTTP 200 for googlebot next week / month / year. so i recommend to stick with google webmaster tools and logfile analysis (visualized with i.e.: munin, cacti, ...)
How did you create the sitemap? I would think most sitemap tools would only include URLs that responded with "200 OK"
Do note that some websites mess up and always respond with response 200 instead of e.g. 404 for invalid URLs. Such websites have trouble ahead :)