doutu2017 2012-06-22 00:59
浏览 91
已采纳

如何阻止这些.htaccess规则清除我的$ _POST变量?

Thanks for the help on here with my query on here the other day with regard to some htaccess problems I've been having - it sent me in the right direction to be able to work out what's causing the problem just I can't work out how to fix it.

The htaccess file for my site is...

<IfModule mod_rewrite.c>

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example.org
RewriteCond %{HTTP_HOST} ^(.+).example.org/^(.+)
RewriteRule ^([^/]*)$ http://example.org [P,L]

ErrorDocument 404 /index.php

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L]

</IfModule>

The first bit allows me to have virtual subdomains for my clients - they all include the same files from my main domain but a different layout is used and different data fetched from the db by my scripts depending on the subdomain. However it seems this code is destroying any $_POST variables... as when I submit a form on the main domain the script picks up the variables whereas with any of the subdomains using the exact same form and exact same script the $_POST variables are blank.

How can I fix that section of code, or add another bit, to allow $_POST variables to be passed as well? Get seems to work on the site using the last section as /logout/?logmeout is recognised it's just Post that is lost.

  • 写回答

1条回答 默认 最新

  • doudiza9154 2012-06-22 01:01
    关注

    If you already have the wildcard vhosts set up that you need to allow such subdomain use, you shouldn't need to redirect to the main domain. Just have your PHP scripts check $_SERVER['HTTP_HOST'] to see what subdomain is being accessed.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)