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 请问一下这个运行结果是怎么来的
  • ¥15 这个复选框什么作用?
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下