Support » How-To and Troubleshooting » .htaccess can’t get rid of www completely

.htaccess can’t get rid of www completely

  • I added the following to .htaccess in the root directory

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

    then “www.domain.com” will become domain.com, but “www.domain.com/wordpress” doesn’t change. so I added the following to .htaccess under /wordpress
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/wordpress/$1 [R=301,L]

    then “www.domain.com/wordpress” works. but “www.domain.com/wordpress/anything” still doesn’t change to domain.com/wordpress/anything.

    what should I do now?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Not sure why it does not work, but your first mentioned rule should cover domain.com/wordpress… as well.
    Where did you place this rule? at the bottom? Try to use it at the top of .htaccess so that it is the first rule being applied.

    I guess the reason the htaccess at the root directory doesn’t cover /wordpress is because there is a htaccess file at /wordpress?

    I moved the rule to the top of .htaccess in /wordpress and it works! Thank you very much!

    Is there any consensus as to if URLs should always be with or without the “www.”. I know it has to be just one or the other, because otherwise if people link to your site both ways, your pagerank can suffer.

    The default in WP 2.0.3 is no “www” right?

    No, there is no default and I think spiders are smart enough to realize that www dot yoursite.com is the same as yoursite.com, i.e. your pagerank will not suffer.

    It’s 100% personal choice for aesthetics.

    Actually – the search engines will give PR to one, but not to the other. They will list in their results one, but not the other. So make sure you pick in the beginning and stick with it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘.htaccess can’t get rid of www completely’ is closed to new replies.
Skip to toolbar