views:

298

answers:

6

I like to make a .htaccess file to redirect any errors I get from a web site.

I have deleted all pages from the old site. But I have no idea what pages people have bookmaked.

The new webpage and website structure is totally different ... so no page is the same as the old one, not event the index document that changed from index.html to index.php.

So here is the .htaccess file I have uploaded to the server ...

FEEL FREE TO COMMENT AND GIVE ME YOUR POINT OF VIEW, WHAT YOU WILL DO?

Maybe it is an overkill ... but it works! Here is the file:

#404 - Not Found The requested URL was not found on this server
ErrorDocument 404 http://acecrodeo.com/new/01-acec.php?lang=fra

#400 - Bad Request Your browser sent a request that this server could not understand
ErrorDocument 400 http://acecrodeo.com/new/01-acec.php?lang=fra

#401 - Authorization Required This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
ErrorDocument 401 http://acecrodeo.com/new/01-acec.php?lang=fra

#403 - Forbidden You don't have permission to access on this server
ErrorDocument 403 http://acecrodeo.com/new/01-acec.php?lang=fra

#405 - Method Not Allowed The requested method GET is not allowed for the URL
ErrorDocument 405 http://acecrodeo.com/new/01-acec.php?lang=fra

#406 Not Acceptable
ErrorDocument 406 http://acecrodeo.com/new/01-acec.php?lang=fra

#409 Conflict
ErrorDocument 409 http://acecrodeo.com/new/01-acec.php?lang=fra

##413 - Request Entity Too Large The requested resource does not allow request data with GET requests, or the amount of data provided in the request exceeds the capacity limit
ErrorDocument 413 http://acecrodeo.com/new/01-acec.php?lang=fra

#414 - Request-URI Too Large The requested URL's length exceeds the capacity limit for this server
ErrorDocument 414 http://acecrodeo.com/new/01-acec.php?lang=fra

##500 - Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request
ErrorDocument 500 http://acecrodeo.com/new/01-acec.php?lang=fra

#501 - Method Not Implemented GET to URL not supported
ErrorDocument 501 http://acecrodeo.com/new/01-acec.php?lang=fra

# ------------ i am not sure the usefullness of these.. put it anyway !

#301 - Moved Permanently The document has moved URL here
ErrorDocument 301 http://acecrodeo.com/new/01-acec.php?lang=fra

#302 - Found The document has moved URL here
ErrorDocument 302 http://acecrodeo.com/new/01-acec.php?lang=fra

#303 - See Other The answer to your request is located URL here
ErrorDocument 302 http://acecrodeo.com/new/01-acec.php?lang=fra

#304 - Not Modified A cached copy will be used
ErrorDocument 304 http://acecrodeo.com/new/01-acec.php?lang=fra

#408 - Request Time-out Server timeout waiting for the HTTP request from the client
ErrorDocument 408 http://acecrodeo.com/new/01-acec.php?lang=fra

#410 - Gone The requested resource is no longer available on this server and there is no forwarding address. Please remove all references to this resource
ErrorDocument 410 http://acecrodeo.com/new/01-acec.php?lang=fra

#411 - Length Required A request of the requested method GET requires a valid Content-length
ErrorDocument 411 http://acecrodeo.com/new/01-acec.php?lang=fra
A: 

You only need 404.

vartec
A: 

You should know that absolute URLs change the original error status code to a redirect status code:

Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as http in front of it), Apache will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server. This has several implications, the most important being that the client will not receive the original error status code, but instead will receive a redirect status code. This in turn can confuse web robots and other clients which try to determine if a URL is valid using the status code. — ErrorDocument Directive

So instead of sending 404 Not Found as answer for a not found resource, Apache will probably send a 302 Temporary Redirect.


What I would do is to handle the error locally with a page that says whatever you want to say to people looking for a document. Maybe something like this:

This website has moved to example.com. But due to a stupid change in the managment system, the old URIs can not be mapped to the new one. We apologize for this and hope you can find the page you were looking for.

That combined with search field should give the user some answer and help for the situation they are facing.

Gumbo
so the solutio is ?
marc-andre menard
For what problem/question?
Gumbo
So you tell me tht only a 404 is enough for the "delete" web page to be redirected to the new one...ok what about the .php?lang=eng. if i forget the ?lang=eng i got an error. does the 404 will fix that ?
marc-andre menard
The 404 just means what the common attached phrase says: Not Found. But this does not necessarily mean that the URI is not valid anymore. It just means that the resource cannot be found at present. If you want to state that the resource is gone, use the “410 Gone” status code instead.
Gumbo
A: 

what about php request

if i request aaa.php (old file) and the new file request aaa.php?lang=eng

it come up with an error... what should i do, redirect ?

marc-andre menard
A: 

a super bizzare side effect of my brand new htaccess file is the css style sheet file does not load... so the file have no style

any idea ?

marc-andre menard
A: 

One thing that might be helpful, if you want to know which pages it's important to redirect because people link to them, is Google web master tools. It will give you a complete list of external links that Google has to pages to your site. Might be useful if you want to do some manual redirects.

Helephant
A: 

You can use Google Webmaster Tools to get an idea about what pages people might have bookmaked. It's free and does not require you to add any scripts or anything to your pages (unlike Google Analytics).

Also, I know this isn't helping you at all, but cool URIs don't change. You've just nuked your PageRank from orbit.

RegDwight