Skip to content

Instantly share code, notes, and snippets.

@umidjons
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umidjons/9183784 to your computer and use it in GitHub Desktop.
Save umidjons/9183784 to your computer and use it in GitHub Desktop.
Hide index file in Yii
# in .htaccess
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
<?php
// in config/main.php
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
'showScriptName' => false, // hide index.php
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment