我的代码以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 –