HTACCESS REDIRECTS

How to create a 301 Redirect using htaccess from an old URL to the new URL

 

  • In order to redirect an old URL to the new URL you can use a 301 redirect in htaccess. Here is an example:
    redirect 301 /oldfile http://www.yourdomainname/newfile

    Note:
     You will need to replace "oldfile" , "yourdomainname" , and "newfile" with the correct values.
  • To redirect all requests to domainname to www.domainname:
    # Rule for duplicate content removal: www.domain.com vs domain.com
    Options +FollowSymlinks 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^domain.com [NC] 
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L,NC]

    Note:
     This .htaccess redirect only works on Linux servers with Apache Mod-Rewrite enabled. (All of Power Shift's Linux Servers has this enabled)
  • 54 Users Found This Useful
Was this answer helpful?

Related Articles

WHERE DO I GO TO LOG INTO CPANEL?

You can log into the control panel with your domain by typing in: www.yourdomain.com/cpanelin the...