2015-04-04 34 views
0

我想將每個.htaccess調用重定向到一個特定的文件。Htaccess API重定向

我想將所有的Get/Put/Post/Delete調用重定向到一個文件夾到一個特定的index.php文件。

我有以下目錄結構:

\var\www\html\app 

內部應用程序我有index.php文件

文件現在我要像

GET http(s)://myWeb.com/app 
POST http(s)://myWeb.com/app 
GET http(s)://myWeb.com/app/helloworld 

任何呼叫重定向到

\var\www\html\app\index.php 

她e是我的失敗嘗試:

RewriteEngine On 
RewriteBase /app/ 
RewriteRule^app/index.php [QSA,L] 
#RewriteRule^index.php [QSA,L] //Tried this one as well 

這的.htaccess裏面

/var/www/html 

我也放在應用程序文件夾內的類似htaccess,但它不工作了。

我應該使用2個htaccess文件嗎?如果一個應該是什麼格式呢?

此外,有沒有工具來檢查htaccess的正則表達式?像www.regexr.com

回答

0

你試過這個嗎?

RewriteRule . app/index.php [R,L] 

我想只有當你想通過URL QSL需要查詢