I have an application that when a new user registers, it creates a folder for that user: /users/$user_id
It then writes an index.php file to that directory, that contains the following code:
<?php
define('GIVE', 'TRUE');
define('GIVE_PATH', dirname(__FILE__));
require(dirname(dirname(GIVE_PATH)) . '/gp_wrapper.php');
?>
It uses the path info to get the users ID for loading the necessary info.
Now, I have a subdomain that redirects to the users folder...
So visiting subdomain.mydomain.com/user_id/ will perform the functions I want for that user...
What I want to do however, is eliminate the need for a user/id folder structure entirely.
I know there is a way that I can use mod_rewrite to have it so that when someone visits subdomain.mydomain.com/user_id/ it will invisibly redirect to www.mydomain.com/index.php?mode=give&id=$id... however I am not very experienced with mod_rewrite and am running into problems...
This is what I have come up with so far... but it is giving me a 404 error.
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !www.mydomain.com
RewriteCond %{HTTP_HOST} subdomain.mydomain.com
RewriteRule .* www.mydomain.com/index.php?mode=give&id=%1
It may also be worth noting, that because this domain that the application is hosted on, it is not actually located in the root public_html folder on my server, where .htaccess is located.
Rather, the root of the domain is at public_html/www.mydomain.com/
Thanks in advance.