How to get rid of www for blog subdirectory
-
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 (www.ellevateme.com will automatically redirect to ellevateme.com), but it will not work for my blog subdirectory (www.ellevateme.com/blog).
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} ^www.ellevateme.com$ [NC]
RewriteRule ^(.*)$ http://ellevateme.com/$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]
</IfModule># END WordPress
I tried adding this:
#redirect to www-less url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.ellevateme.com/blog/$[NC]
RewriteRule ^(.*)$ http://ellevateme.com/blog/$1 [R=301,L]to that .htaccess file, but it didn’t seem to do anything. If I go to http://www.ellevateme.com/blog the url stays just like that, and if I go to ellevateme.com/blog, it adds in the www. Does anyone know how to fix this?
- The topic ‘How to get rid of www for blog subdirectory’ is closed to new replies.