Forum Moderators: phranque

Message Too Old, No Replies

How can I stop this .htaccess code clearing my $ POST data?

         

scottcabal

1:04 am on Jun 22, 2012 (gmt 0)

10+ Year Member



Hey everybody,

Thanks for the help with my query on here the other day with regard to some htaccess problems I've been having - by researching a bit more I was 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.com
RewriteCond %{HTTP_HOST} ^(.+).example.com/^(.+)
RewriteRule ^([^/]*)$ http://example.com [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.

scottcabal

1:37 am on Jun 22, 2012 (gmt 0)

10+ Year Member



Update - I've managed to get an answer on another site which has fixed the problem. What I did was remove that section in the htaccess completely and just set up a wildcard vhost entry manually in cpanel which did the same thing and it seems to work as intended now... but thanks for anybody that intended to help after reading.