Welcome Guest, Not a member yet? Register   Sign In
Force www. included in URL
#1

[eluser]iive[/eluser]
Hi, I would like to make sure all request to my site is in www.mysite.com instead of mysite.com. I do not know how to configure my .htaccess file to do that.

I have googled it a bit and I got a solution for that.. but it doesn't work properly if I combined it with my current .htacess file which hide the index.php from the URL.


.htaccess that force www in the url
Code:
RewriteCond %{HTTP_HOST} !^www.mysite.com$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301]

.htaccess that hide index.php from url
Code:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !(.jpg|.gif|.png|.swf|.css|.js|.txt)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>
Anyone can help? I am not very good in apache. Sorry.


Messages In This Thread
Force www. included in URL - by El Forum - 03-26-2008, 03:20 AM
Force www. included in URL - by El Forum - 03-26-2008, 03:46 AM
Force www. included in URL - by El Forum - 03-26-2008, 03:47 AM
Force www. included in URL - by El Forum - 03-26-2008, 04:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB