I've spent the last 24 hours looking for solutions to my problem both here and by searching google but I've been unable to find anything. Sorry if this is duplicated anywhere however.

For the last version of my site, written in php, I just had one index page which I used requests like this to grab the correct page: I'm now writing the new version of the site, also in php, and I'm trying to make it have search engine friendly urls / slugs for example


I've managed to get it so that virtual subdomains work for each client, using the top portion of the code below, and I've managed to get the slug pages to work using the bottom portion.

The problem I'm having is with forms, such as the form to sign up for the site, edit a user profile etc. I've read on this site that with apache rewrites $_POST variables should be passed to the script, unlike with redirects, but I'm using rewrite and when any form data is passed to a slug (for example /profile/edit) it doesn't work, although if it's passed to virtualsubdomain.mydomain.com/test.php for example it does.

Can anybody help me out and find a way to fix the htaccess file below and allow $_POST vars to be passed to my slug script (index.php in the code below)? There's probably just a small thing I'm missing.

<IfModule mod_rewrite.c>RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomainhere.org
RewriteCond %{HTTP_HOST} ^(.+).mydomainhere.org/^(.+)
RewriteRule ^([^/]*)$ [mydomainhere.org...] [P,L]

ErrorDocument 404 /index.php

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php
I can't work out why post vars can be read by php files that exist in the subdomains that are only virtual, but they can't be read when post them to a slug (such as /profile/editprofile). Global variables are off on my server but The following just brings up the default blanked variable so they obviously havent been passed.

PHP Code:
$test ''//define the variable to please global vars off
$test $_POST["namehere"];
I'm fairly new to using htaccess files for anything other than just including a custom error file as you can probably tell.