我的代碼以URL運行:如何隱藏在Yii框架從我的網址的index.php
http://localhost/yii/index.php/Adminlogin
我想要的URL看起來像:
http://localhost/yii/Adminlogin
.htaccess文件
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
main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'redirect/<redirectUrl>'=>'site/index',
'login'=>'site/login',
'privacy'=>'site/privacy',
'password'=>'site/forgot',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
的
可能的重複[如何隱藏yii的index.php文件在apache/.htaccess/mod \ _rewrite?](http://stackoverflow.com/questions/26061591/how-can-i -hidden-the-index-php-file-for-yii-in-apache-htaccess-mod-rewrite) –
你可以參考這個文檔URL以供你參考:http://stackoverflow.com/documentation/yii/6143/設置在你的主要的php文件#t = 201610270410382135132 –