Forum Moderators: phranque
RewriteCond %{HTTP_HOST}!^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Or, for www-to-non-www redirection, use this syntax:
RewriteCond %{HTTP_HOST}!^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
There is only one problem with this ... I have never done this before! Somebody please help me!
What is a .htaccess file? Do I create this in notepad and save as a .htaccess file ... then upload to the root folder through dreamweaver where I would normally put my .index file?
Any help WILL help ... Looking forward to the comments!
Welcome to WebmasterWorld!
I don't know anything about uploading with dreamweaver, but generally, yes, you would upload a plain-text file named ".htaccess" to the same directory where your home page and robots.txt file reside.
Note that on all servers, you'll need to preface whichever of those two code snippets you choose with the line:
RewriteEngine on
Options +FollowSymLinks
---
Full example:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Jim