I am familiar with modifying .htaccess
files but my initial attempts to do so continue to fail.
Ultimately, I want to point users to 'imaginary' subdomains (those which do not exist) so that the subdomain can be parsed correctly with PHP and MySQL to find the particular member's information. It is my assumption that MediaTemple has something configured to always check for a true subdomain directory prior to any access so the .htaccess
file settings are never touched and in turn just generate errors.
For example:
When somebody goes to www.example.com
currently, it shows the parent site including information on how to become a member. Once a person is a member, their 'unique' URL is:
www.example.com?MemberID=12345
ultimately, forcing the member to remember the question mark agent equals can be confusing along with the need to remember the proper capitalization and such.
I would 'like' to achieve the following:
www.12345.example.com
redirects to
www.example.com/index.php?MemberID=12345
(index.php
reads the 12345
like a $_GET
function to properly lookup the ID
, valid and return response based on that.)
I believe we could? achieve the same using information after the slash:
e.g. www.example.com/12345
The issue is we already have other pages using /xxxx
to modify client content as well as I don't want to block anybody's ability to simply visit: www.example.com/contact
for example as a live link.
(where the site redirects to index, tries to look up memberid = 'contact' and does not find any results).
My .htaccess is currently:
ErrorDocument 404 /404.php
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(.+)\.example\.com
RewriteRule .* http://example.com/processing_page.php?ID=%1 [L,R]
I would expect based off my needs that typing www.something.example.com
I would be redirected to: www.example.com/processing_page.php?something
Instead, it just redirects to my mediatemple hosting page (essentially stating no subdomain named 'something' exists).
I am running our server on a Media Temple DV 3.5 server running CentOS5 and LAMP stack.