I am newbie to Yii framework. I have uncommented the url manager in the config file and got a url scheme like this:
http://localhost/mysite/index.php/displayAll
I don't want the index.php in the url. So I want a url some thing like this
http://localhost/mysite/displayAll
To accomplish this, what should I do. I did play with the url manager and some htaccess, but nothing gone well.
Please help
Try:
On IIS 7, IIS 7.5, IIS 8, IIS 8.5, IIS 10
Make sure you have the URL Rewrite module installed. Can be found here: http://www.iis.net/downloads/microsoft/url-rewrite
remove comment from config/main.php or config/web.php
Create new file in the web directory basic/web/web.config and add in system.webServer
Example result: http://localhost/basic/web/site/contact
In httpd.conf look for,
(remove # from the begining of line if not already removed.)
Create .htaccess in directory where your index.php is, and paste following code:
And in protected/config/main.php
If still not getting clean url,goto virtual host config file "httpd-vhosts" incase of you are using it, and paste in your config,
In your .htaccess you should have this:
Then you have to add the urlManager component to your main config file:
Notice the 'showScriptName'=>false, this will hide 'index.php' from the generated URL.
To find everything about Yii's URL Manager check out this topic in Yii's documentation: http://www.yiiframework.com/doc/guide/1.1/en/topics.url