WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess can't get rid of www completely (6 posts)

  1. feedpuppy
    Member
    Posted 8 years ago #

    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?

  2. Michael_
    Member
    Posted 8 years ago #

    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.

  3. feedpuppy
    Member
    Posted 8 years ago #

    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!

  4. slobizman
    Member
    Posted 8 years ago #

    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?

  5. 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.

  6. ladydelaluna
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic