.htaccess - Non WWW to WWW redirection using htaccess File -


i using codeigniter-. domain not redirect www version.

for example if type mydomain.com stays mydomain.com. want redirect www.mydomain.com.

if types mydomain.com/controller/method should www.mydomain.com/controller/method.

another problem: tried other solutions problem when redirects www version, automatically adds "index.php" in url. when type www in domain name works fine, no "index.php" in url. problem occurs during redirection.

here .htaccess file (i've removed redirection code)

rewritecond $1 !^(index\.php|system|rpc_relay.html|canvas.html|robots\.txt) rewritecond $1 !^(sitemap\.xml|export) rewriterule ^(.*)$ /index.php/$1 [l] 

any appreciated.

to redirect http:// http://www. , , remove route file (index.php) in url, put these lines on htaccess :

rewriteengine on rewritecond %{http_host} !^www.domain.com$ [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [l,r=301] rewritecond $1 !^(index\.php|images|css|js|styles|robots\.txt) rewriterule ^(.*)$ /index.php/$1 [l] 

the domain :

domain.com 

folder direct access :

images|css|js|styles 

hope help


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -