Welcome to WebmasterWorld Guest from

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

Problems Redirecting non www to www.

problems redirecting non www to www



3:06 am on Jan 19, 2009 (gmt 0)

5+ Year Member

I have been at this for a few hours.
I want to direct all visitors that go to my site via:

to be redirected to http://www.example.com.

I tried to do this myself by going into my Control Panel (I use Pappashop's hosting service). In Control panel I was able to assign this redirect, but I realized I needed to alter my .htaccess file.

I did this after finding the (supposedly) appropriate code online, but it did not work. I know I uploaded the revised file correctly so it wasn't an error like that.

I am at a loss: my site will not come up now when i type in either URL (www.example.com or example.com).
I appreciate any help in advance. losing $$$ as I type...


3:38 am on Jan 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

hi stayce

welcome to WebmasterWorld :o)

try this code

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]

hope this helps



3:58 am on Jan 19, 2009 (gmt 0)

5+ Year Member

thank you!
i havent tried it yet, but wanted to ask if it where it went.
this is what i have at the beginning:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

so, should i put it directly under:
RewriteEngine On



4:01 am on Jan 19, 2009 (gmt 0)

5+ Year Member

ok i went ahead and tried it directly under:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

it didnt work. any other ideas?
thank you so much for the help!


4:15 am on Jan 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

could you post your entire .htaccess file?


6:17 am on Jan 19, 2009 (gmt 0)

5+ Year Member

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule category/new(.*).htm$ catalog.htm?new=yes&page=$1
RewriteRule category/new.htm$ catalog.htm?new=yes

RewriteRule category/sale(.*).htm$ catalog.htm?sale=yes&page=$1
RewriteRule category/sale.htm$ catalog.htm?sale=yes

RewriteRule category/all(.*).htm$ catalog.htm?all=yes&page=$1
RewriteRule category/all.htm$ catalog.htm?all=yes

RewriteRule category/featured(.*).htm$ catalog.htm?featured=yes&page=$1
RewriteRule category/featured.htm$ catalog.htm?featured=yes

RewriteRule category_(.*)/(.*)/(.*).htm$ catalog.htm?category=$1&page=$2
RewriteRule category_(.*)/(.*).htm$ catalog.htm?category=$1

RewriteRule item_(.*)/new/(.*).htm$ catalog.htm?item=$1&new=yes
RewriteRule item_(.*)/all/(.*).htm$ catalog.htm?item=$1&all=yes
RewriteRule item_(.*)/sale/(.*).htm$ catalog.htm?item=$1&sale=yes
RewriteRule item_(.*)/featured/(.*).htm$ catalog.htm?item=$1&featured=yes

RewriteRule item_(.*)/(.*)/(.*).htm$ catalog.htm?item=$1&catid=$2
RewriteRule item_(.*)/(.*).htm$ catalog.htm?item=$1

RewriteRule article_(.*)/(.*).htm$ articles.htm?article=$1

AddType application/x-httpd-php .php .htm .htmlRewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "http\:\/\/www\.example\.com" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ "http\:\/\/www\.example\.com\/" [R=301,L]


Featured Threads

Hot Threads This Week

Hot Threads This Month