关于.htaccess设置
时间:2021-07-01 10:21:17
帮助过:14人阅读
工程的目录是
project
public
index.php
xxxx
xxxx
想实现的功能是无论用什么url访问,比如
http://localhost/project/
http://localhost/project/aaa.php
http://localhost/project/public/bbb.php
都能够转到public下的index.php
我现在在project下和public下各有一个.htaccess
project/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) public/$1 [L]
public/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
要访问
http://localhost/project/public/bbb.php
可以转到index.php下,
但是
http://localhost/project/aaa.php
并不能实现,
请问,该怎么设置呀
谢谢了
回复讨论(解决方案)
没有问题
http://localhost/project/aaa.php
[PHP_SELF] => /project/public/index.php
[REDIRECT_URL] => /project/public/aaa.php
[REQUEST_URI] => /project/aaa.php
http://localhost/project/public/bbb.php
[PHP_SELF] => /project/public/index.php
[REDIRECT_URL] => /project/public/bbb.php
[REQUEST_URI] => /project/public/bbb.php
版主的意思是,这么设置没有问题是吗?
怎么我的环境不好用呢
我用了一个Slim框架,难道是这个slim的问题?