1. Redirect to Files or Directories

Redirect permanent /oldfile.html http://www.domain.com/filename.html or
Redirect 301 /oldfile.html http://www.domain.com/filename.html

Redirect 301 /olddirectory/oldfile.html http://www.domain.com/newdirectory/newfile.html

Redirect 301 www.olddomain.com/

Also you can program your home page to always load the www.domain.com version of the URL regardless of your actualy homepage file or a user not typing www.

1a.To redirect the non-www version use:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

1b.To prevent

  • Share/Bookmark

No Comments on “.htaccess commands”

Comments on this entry are closed.