關於.htaccess設定

來源:互聯網
上載者:User
工程的目錄是
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的問題?

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.