Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2012
    Thanked 4 Times in 4 Posts

    Post Making a PHP file look like a subdomain.

    So basically, I need my PHP file to look like a subdomain. Here's what I have so far:

    <IfModule mod_rewrite.c>
    	RewriteEngine On
    	RewriteBase /
    RewriteRule ^([A-Za-z0-9]+).mysite.com$ administrator/domain.php?domain=$1
    I'm no Apache genius, so could someone help me out here?

  2. #2
    New Coder
    Join Date
    Nov 2011
    Thanked 26 Times in 26 Posts
    Do requests for http://www.subdomain.yourdomain.tld ever arrive at your server in the first place?

    I can see two problems with what you want to do. DNS and Apache Host Configuration. If I call up http://www.subdomain.host.tld then DNS is going to go away and look for an IP address for www.subdomain.host.tld, my browser will go to that IP where Apache will steer me into subdomain - which needs to be defined specifically(or caught with a wildcard alias), or I'll end up at the default website for that server. It will be the .htaccess file in the landing directory that I will trigger, so where I land is important.

    Basically you cannot call up www.subdomain.host.tld and arrive at www.host.tld instead, unless you have dns records for the subdomain, or have a wildcard DNS record for any unknown entries. (see: http://en.wikipedia.org/wiki/Wildcard_DNS_record). Even with this in place, you would then need Apache to react to these specific subdomains with an alias declaration.

    Forget about the syntax of .htaccess for the moment and think about basic traffic flow. If you can get traffic for http://www.anysubdomain.yourdomain.tld to arrive at your server, and are able to add a wildcard subdomain alias to your httpd.conf/vhost, you have a fighting chance of doing what you want.

    This may help you: http://muffinresearch.co.uk/archives...ies-in-apache/
    Last edited by leslie.jones; 03-09-2012 at 07:57 AM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts