to hide "index.php" from the url on a website, add an .htaccess file to your web root, with this text:
Options +FollowSymLinks
IndexIgnore */*
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
and in /protected/config/main.php, set:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'caseSensitive'=>false,
Nice blog, thanks!
ReplyDeletei am not able to find webroot in apache .
ReplyDeleteplz help me out where is the exactly location.
Web root is your project directory.
Deletefor example if your project is in /var/www/myproject
you need to put the .htaccess file under your webroot means /var/www/myproject/.htacess
I hope this helps.
http://www.webnapps.co.uk
Excellent and straight to the point!
ReplyDeleteI found another resource on the web, this is what I used: http://macinville.com/119/remove-indexphp-in-yii-web-application/