.htaccess - htaccess — redirect to www and catch all index.php -


i'm new htaccess, apologies in advance. i'm trying redirect non-www www. far good. @ same time i'm trying catch , clean link ("index.php" not shown) index.php.

i tried combine following lines, didn't succeed in make htaccess work properly:

 rewritecond %{http_host} !^www\.  rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,nc]  rewritecond %{request_filename} !-f  rewritecond %{request_filename} !-d  rewriterule ^(.*)$ index.php?/$1 [qsa] 

it redirects non-www www , doesn't show "index.php". want keep full url.

example:

example.com/subfolder should link www.example.com/subfolder show index.php

thanks help!

i (hopefully) answered own question trial , error.

rewritecond %{http_host} !^www.example.com$ [nc]  rewriterule ^(.*)$ http://www.example.com/$1 [r=301,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^?]*)$ /index.php?path=$1 [nc,l,qsa] 

of course rewriteengine on


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -