Codxplore.com

Latest news: New android application Islamic Video has been released. its a free islamic video application for android smartphone. Download now!


First, let's enable Yii2's pretty URLs with mod_rewrite. On the Yii home page, if you click on the About menu option, the URL will be something like http://localhost/hello/web/index.php?r=site%2Fabout. We'd like to change that to http://localhost/hello/web/site/about.

The config subdirectory includes environment configurations for your web and console applications as well as the future database settings. Edit /config/web.php to add urlManagement to the current web application. Add the following urlManager section within the components array:

Then, create an .htaccess file within /web where the primary index.php file exists:

Make sure mod_rewrite is running locally on MAMP; if not, check out this Stack Overflow guide.

In your browser, visit this URL: http://localhost/hello/web/site/about. You should see the Yii application About page and clicking on other menu options should bring up pretty URLs.

Tags : PHP, Yii2,

Views : 1053

Subscribe Us


Follow Us