【发布时间】:2015-04-04 08:50:54
【问题描述】:
我想将每个 .htaccess 调用重定向到特定文件。
我想将所有对文件夹的 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
这是我失败的尝试:
RewriteEngine On
RewriteBase /app/
RewriteRule ^ app/index.php [QSA,L]
#RewriteRule ^ index.php [QSA,L] //Tried this one as well
这个.htaccess 在里面
/var/www/html
我还在 app 文件夹中放置了一个类似的 htaccess,但它也不起作用。
我应该使用 2 个 htaccess 文件吗?如果是一个,它的格式应该是什么?
另外,是否有检查 htaccess 正则表达式的工具?类似于 www.regexr.com
【问题讨论】:
标签: php apache .htaccess mod-rewrite redirect