To redirect from one URL to another, add the following line to the .htaccess file:
Redirect [status] sourcepath targeturl
Redirect is the keyword that specifies a redirect is to be performed.
status is an optional keyword that indicates whether this redirect is expected to change over time. If omitted, or specified as the default, temp, browsers will check with the server every time the source URL is accessed. If specified as permanent, the redirect isn't expected to change, and browsers will cache the redirect.
Permanent redirects have search engine optimization advantages, and typically redirects should be specified as permanent.
sourcepath is the path part of the URL to be redirected. The path must not include the hostname and must start with a slash.
targeturl is the URL to redirect to. If the target url is on the same hostname as the source url, the protocol (http:// or https://) and hostname should be omitted.
Directory renamed within a website
Suppose that in Provost's Office, the Office of New Engagement, with the URL:
is renamed to the Tower of Web Operations with the URL:
Furthermore, suuposed that the website structure is essentially unchanged. Until all links have been updated, a redirect can direct people that use the old URL to the new URL. The following line in the .htaccess file, in the provost folder, will do the redirect:
Redirect permanent /one /two
Characters in the original URL after sourcepath are appended to the target URL. For example, the URL:
will be redirected to
Redirects should not be used an excuse to let old URLs persist indefinitely. After a department or directory rename, redirects are an important tool to avoid broken links. However, over time links should be changed to directly go to the target URL.