Mutikasa
Power Member
- May 23, 2011
- 589
- 216
So, I populated wordpress with posts and then made apache Vhost to point domain to wordpress folder. First, i needed to change site URL from General Options in database. I put like this http://www.example.com with www part. But when i enter the link in address bar it redirects me to the default root folder (/var/www/, wordpress is in /var/www/wordpress/) and www part disappears from url. I don't know why wordpress redirects me to without www part and apache activates default Vhost. This is the .htaccess of wordpress
I did manage to find solution which is creating .htaccess in the root folder which redirect to the url WITH www part. This is it:
But i still want to know why and how wordpress does that and how to fix it inside wordpress.
Thanks
Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
I did manage to find solution which is creating .htaccess in the root folder which redirect to the url WITH www part. This is it:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}$1 [R=301,L]
But i still want to know why and how wordpress does that and how to fix it inside wordpress.
Thanks