Blog

[How to] 301 Redirect with .htaccess (Apache/cPanel/Linux VPS)

A 301 Redirect, or permanent redirect, is a useful tool for redirecting traffic from one webpage to another. The benefit of the official 301R is that it is Google-approved and SEO friendly. Typically Google will recognize the permanent redirection, and will adjust search results and indexed pages accordingly.

To setup a 301 Redirect requires access to your website’s files. Log in with FTP or another method, and follow the steps below:

1. Look for a file called .htaccess in public_html, the web directory of the website/location you want to redirect from. You may need to enable View Hidden Files to see .htaccess. If it does not exist, create it.

2. Add this line to .htaccess to setup a 301 redirect for a specific page:

Redirect 301 /old-file-name.html /new-file-name.html
3. Add this line to 301 redirect a directory:
Redirect 301 /old-directory-name /new-directory-name

You can also 301 redirect to a new domain:
Redirect 301 /old.html http://www.newdomain.com/new.html

After adding the appropriate line (called a rule), save the .htaccess file. The changes should go into effect immediately.

This process should be the same on any cPanel VPS, or other Linux server running Apache.
This entry was posted in Guides & How To's, Linux VPS, Tech Support, VPS Hosting and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.



Questions? We're here to help.