Heim > Backend-Entwicklung > PHP-Tutorial > 关于.htaccess设置

关于.htaccess设置

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-23 13:55:55
Original
1070 Leute haben es durchsucht

工程的目录是
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的问题?

Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage