yii1 urlManager地址问题 [ 未指定版本 ]
首先服务器用的nginx
问题:经过我下面的配置,在地址栏访问必须出现2个.php才能访问成功(我是我想要的)
如右边的:
http://localhost/svn2/index.php/test/test.php
(我不喜欢但是能访问的)
但我想要的是这样的(不能实现):
http://localhost/svn2/test/test.php或者http://localhost/svn2/index/test/test.php
main.php中配置
	'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,//隐藏.php
			//'caseSensitive'=>false,
			'urlSuffix'=>'.php',
			'rules'=>array(
				//没写 
			),
		),
nginx主要配置如下 本地用nginx测试的
 server {
        listen       80;
        server_name  localhost;
	 index  index.php index.html index.htm index.*;
	 root   D:/Nginx/www;
配置urlmanager为不显示index.php,但没什么用
 location / {
		if (!-e $request_filename){  
			rewrite ^/(.*) /index.php last;  
		} 			
         }
配置
location ~ .*\.(php|php5)?$ {
         fastcgi_pass   127.0.0.1:9001;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;
    }
}
共 4 个回答
- 
 - 
 - 

在你的app根目录下创建.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 - 

<IfModule mod_rewrite.c> 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 </IfModule> 
as5772830
            注册时间:2013-10-30
最后登录:2019-01-28
在线时长:11小时17分
    最后登录:2019-01-28
在线时长:11小时17分
- 粉丝1
 - 金钱5
 - 威望0
 - 积分115