关于.htaccess设置

WBOY
Release: 2016-06-23 13:55:55
Original
953 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!