Welcome Guest, Not a member yet? Register   Sign In
How to 301 redirect non-www to www url
#1

[eluser]senz[/eluser]
Hi all,
I want to redirect my website from non-www to www url and i got some code like this :

RewriteCond %{HTTP_HOST} ^yoursite.com$
RewriteRule ^(/)?(.*) http://www.yoursite.com/$2 [R=301,L]


I had change my htaccess file with adding that code, but when i write the address : mysite.com, the redirect is going fine and be like this : www.mysite.com. And when i click some page : www.mysite.com/about, my website is going like this : www.mysite.com/index.php/about.

My question is, how to remove "index.php" from the address of my website and i had change the existing configuration in config.php file ($config['index_page'] = "index.php";) to be ($config['index_page'] = ""Wink


Thanks,
Senz
#2

[eluser]Mischievous[/eluser]
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

found @ http://ellislab.com/codeigniter/user-gui.../urls.html




Theme © iAndrew 2016 - Forum software by © MyBB