Maybe it looks simple, but some time ago I need some time to find a solution of this case. I finally got it, and I want to share that I also experienced such cases. So that it can make reference.
Neither let us do the steps:
- Make sure that the hosting / your pc mod_rewrite module is active. if not actively try to activate in a way, open the httpd.conf file. You can check this in the phpinfo.php to find out.
change this setting :
#LoadModule rewrite_module modules/mod_rewrite.so
to be
LoadModule rewrite_module modules/mod_rewrite.so
- then go to .htaccess file, and try to modify to be:
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
if above does not work try with this:
RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.php RewriteRule . index.php
- move .htaccess file to root directory, where is index.php thare.
www - protected - index.php - .htaccess
- Set main.php in your yii configuration, at component :
'urlManager'=>array( 'urlFormat'=>'path', 'showScriptName'=>false, 'caseSensitive'=>false, ),
- so.., good luck
For reference material I managed to do in my personal website (check my profile).
NB: This for hide index.php
Total 12 comments
Also, if you're on a virtual directory (e.g. using
on your apache configuration) you MUST use a
statement on your .htaccess file, other than the rewrite won't work again.