Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-08-2012, 07:29 PM   PM User | #1
DarkLaika
New Coder

 
Join Date: Jan 2012
Posts: 53
Thanks: 8
Thanked 4 Times in 4 Posts
DarkLaika is an unknown quantity at this point
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:

Code:
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /
RewriteRule ^([A-Za-z0-9]+).mysite.com$ administrator/domain.php?domain=$1
</IfModule>
I'm no Apache genius, so could someone help me out here?
DarkLaika is offline   Reply With Quote
Old 03-09-2012, 07:49 AM   PM User | #2
leslie.jones
New Coder

 
Join Date: Nov 2011
Posts: 88
Thanks: 4
Thanked 26 Times in 26 Posts
leslie.jones is an unknown quantity at this point
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..
leslie.jones is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:41 AM.


Advertisement
Log in to turn off these ads.