.htaccess POST数据被阻止

时间:2014-07-25 08:52:47

标签: php .htaccess post

我将表单中的POST数据发送到将重定向的根索引:

<form action="index.php?menu=blog&section=admin" method="post">

但这行在.htaccess blok POST数据:

RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*) http://www.example.com/$1 [QSA,L]

我尝试了其他几个问题但同样的问题:

#RewriteRule ^(.*) http://www.example.com/$1 [QSA,L,R=301]
#RewriteRule (.*) http://www.example.com/$1 [QSA,L,R=301]
#RewriteRule ^(.*) www.example.com/$1 [QSA,L,R=301]
#RewriteRule ^(.*) http://www.example.com/$1 [QSA,NC,P] #Doesn't rewrite "www"

还有一些其他帖子有类似的问题,但我找不到我的解决方案

如何将POST数据发送到index.php?menu = blog&amp; section = admin?

谢谢!

1 个答案:

答案 0 :(得分:1)

试试这些规则

将product.php?id = 12重写为product-12.html

  RewriteEngine on
  RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1

将product.php?id = 12重写为product / ipod-nano / 12.html

  RewriteEngine on
  RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2

将非www URL重定向到www URL

  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^viralpatel\.net$
  RewriteRule (.*) http://www.viralpatel.net/$1 [R=301,L]

将yoursite.com/user.php?username=xyz重写为yoursite.com/xyz

  RewriteEngine On
  RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
  RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1

将域重定向到public_html内的新子文件夹

  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www\.test\.com$
  RewriteCond %{REQUEST_URI} !^/new/
  RewriteRule (.*) /new/$1