Hide index.php in Yii framework
- 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, ),
and then try the following url
http://localhost/yii_framework/?site/index
Good Luck ! :)
0 comments