http://www.example.com/admin = http://www.example.com/index.php/admin
搭配 phpstudypro
1.首先将网站目录定位到项目的public路径
如果开启的是 Apache服务器
在public文件夹里面的 .htaccess文件写入
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
如果开启的是 Ngnix服务器
在public文件夹里面的 .ngnix.htaccess文件写入
if (!-d $request_filename) {
set $rule_0 1$rule_0;
}
if (!-f $request_filename) {
set $rule_0 2$rule_0;
}
if ($rule_0 = "21") {
rewrite ^/(.*)$ /index.php/$1 last;
}
亲测可用!
博客介绍了http://www.example.com/admin与http://www.example.com/index.php/admin的搭配,使用phpstudypro。需将网站目录定位到项目的public路径,若开启Apache服务器,在public文件夹的.htaccess文件写入相关内容;若开启Ngnix服务器,在.ngnix.htaccess文件写入,亲测可用。

1266

被折叠的 条评论
为什么被折叠?



