Wednesday, January 5, 2011

Using Path URLs and hiding index.php

Add a .htaccess file to your web application root (same level but not inside protected). Copy and paste one if necessary.

The file contents should be this:

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

Then in /protected/config/main.php, set 'showScriptName'=>false in the urlManager section.

No comments:

Post a Comment