How to redirect HTTP requests using apache

This article shows how to configure apache to do redirects.

Permanent redirect:

If your url has moved pernamently, edit the .htaccess file and the following line:

 
Redirect 301  /OLD_URL/ /NEW_URL/

A 301 redirect also updates the google index, so you don't loose the creation time and the file doesn't look like a new one to Google eventhough the content is the same.

Temporary redirect:

If the page has moved temporarily, it correspond to a 302 response in http. You need to add the following line to the .htacess file from apache:


Redirect 302  /OLD_URL/ /NEW_URL/

References:

Apache

Share this article:

Recent Comments