Welcome Guest, Not a member yet? Register   Sign In
Redirect site.com to www.site.com automaticly
#1

[eluser]serhat[/eluser]
Hello,
When i enter site.com the url bar has no www. in front of domain name automaticly.
I want to do this automaticly for seo purposes.
How can i do this?
By the way in internal urls like "site.com/blabla" i want it to be as "www.site.com/blabla" automaticly.
Thanks for help
By the way
This is my current htaccess
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
#2

[eluser]Paul Rose[/eluser]
I have a system that manages multiple domains from the same CI installation. We simply set the CNAME of a domain to point where we want. Havig multiple domains meant I didnt want to edit the .htaccess every time we added a new domain in so this was the solution.....

Code:
RewriteCond %{HTTP_HOST} !^(www.*)
RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#3

[eluser]serhat[/eluser]
It works great but with one problem
now when i enter urls these are my responses in url bar
url.com => www.url.com/ ->This is great
www.url.com => www.url.com/ -> This is also great
www.url.com/blablabla => www.url.com/blablabla This is also great
url.com/balbalba = > www.url.com/index.php/blabla
This is the problem .
I already removed index.php from my website from config. And i changed htaccess settings for it as you can see.
#4

[eluser]jdfwarrior[/eluser]
why dont you just check your server variables?
#5

[eluser]jurosik[/eluser]
hi, i'm using this code:

Code:
RewriteCond %{HTTP_HOST} ^domain.tld
RewriteRule (.*) http://www.domain.tld/$1 [R=301,QSA,L]

RewriteBase /CommunityRoute
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|css|javascript|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]

try it and let us know..




Theme © iAndrew 2016 - Forum software by © MyBB