Home > Support > HOWTO List > Web > Virtual Hosts: Apache page redirection

Redirecting an Incoming Request

Sometimes you have content which has been moved or deleted, but you'd like to return something to the client instead of the dreaded 404 response.  In this case, you can use the Redirect directive to specify what you want to do:


# Temporary Redirect (code 302)
Redirect      /your/path/file.html http://yourdomain.com/some/path/file.html
Redirect temp /your/path/file.html http://yourdomain.com/some/path/file.html

# Permanent Redirect (code 301)
Redirect permanent /your/path/file.html http://yourdomain.com/some/path/file.html

# Moved (code 303)
Redirect seeother /your/path/file.html http://yourdomain.com/some/path/file.html

# Gone (code 410)
Redirect gone	/your/path/file.html

Note, these do not have to be static html files, the incoming and redirected requests could be to any resource type.

Sometimes the "Redirect" method is not as flexible as you might wish, in that case try using the rewrite module. You may need to enable or install that. Let us know in a ticket if you need some help there.