apache mod-rewrite : Can I have different rules for POST and GET requests?

标签 apache mod-rewrite

我有一个看起来像这样的重写规则:

RewriteRule ^foo/bar/([\w]+)/files/([\S\s]+)$ /mydirectory/$1/$2

我希望 GET 请求转到/mydirectory/$1/$2 而 POST 请求转到不同的地方。这是否可以使用 mod-rewrite 实现?

最佳答案

是的 - 使用 THE_REQUEST 变量。参见 the docs

关于apache mod-rewrite : Can I have different rules for POST and GET requests?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4134474/

相关文章:

.htaccess - .htaccess 中的多 View 选项到底有什么作用?

Apache 在 mod_jk 之前重写(删除 www)

php - '/var/spool/cron' 不是目录,正在退出。尝试通过 PHP 的 shell_exec 使用 crontab 时

apache 服务器中的 Python Cgi 脚本

apache - .htaccess 非 www 重定向到根文件夹的子文件夹

apache - 根据请求启用 mod_expire

php - Mod_Rewrite : Testing URL got indexed in Google - How do I create a proper 301 redirect?

php - 用于 php 网站的独立文件服务器

apache - 从现有的 Ubuntu + 应用程序创建 Docker 镜像

带有http的git克隆在gitlab中不起作用