Support » Everything else WordPress » How to get rid of www for blog subdirectory

  • Resolved ElleG


    I cannot seem to get rid of the www. at the beginning of my blog url. I got rid of it for my main page ( will automatically redirect to, but it will not work for my blog subdirectory (

    This is what the .htaccess file contains in my root directory (public_html):
    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php

    # redirect all traffic to the www-less domain
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^$ [NC]
    RewriteRule ^(.*)$$1 [R=301,L]

    I see there is also a .htaccess file in the /blog subdirectory, and it contains what WP put in:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]

    # END WordPress

    I tried adding this:

    #redirect to www-less url
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^$[NC]
    RewriteRule ^(.*)$$1 [R=301,L]

    to that .htaccess file, but it didn’t seem to do anything. If I go to the url stays just like that, and if I go to, it adds in the www. Does anyone know how to fix this?

Viewing 1 replies (of 1 total)
  • ElleG


    I figured it out. Someone at my host clued me in.

    I didn’t need to make any changes to the .htaccess file in the /blog subdirectory. All I had to do was go to my WordPress dashboard, go to Settings, and change my site and blog url to the www-less version (

    Et voila! No more www in front of my url for my blog.

Viewing 1 replies (of 1 total)
  • The topic ‘How to get rid of www for blog subdirectory’ is closed to new replies.