...

htaccess: multiple redirect/mod rewrite

droliff
01-17-2009, 11:15 PM
Hi all,

I came here for a solution to, what I initially was referring to as 'virtual hosting' but have since learned it is called an Apache mod rewrite.
Condensing the story, a short time ago I registered a domain name, we'll call it domain_B.com, for a club that I am in, so that I could host a website on my Verio.com hosting plan (where I have my primary domain registration, domain_A.com (http://dennisroliff.com/folio) for my business website). I registered with GoDaddy because I didn't know it would be easier to register through Verio. Anyway after correcting the A records and DNS records on the the Godaddy domain_B.com control panel to point it to my Verio server I came here for advice on an Apache mod rewrite solution to direct domain_B.com traffic to a folder in my Verio server root directory named domain_B.com. R Medek and Schleppel gave me codes to place into a .htacces file in the root directory of my server that worked. Medek's was a bit simpler so I am currently using that:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} domain_B.com$
RewriteCond %{REQUEST_URI} !domain_B.com/
RewriteRule ^(.*)$ domain_B.com/$1

Here's my current situation and question:

I just registered another domain name, we'll call domain_C.com. I would like to do the same thing that I did with domain_B.com and host that site on my Verio hosting plan.
This time I registered through Verio so the A and DNS records were all correct. I placed a folder named domain_C.com in the root directory of my server. I then wrote the following code in my .htaccess file:

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} domain_B.com$
RewriteCond %{REQUEST_URI} !domain_B.com/
RewriteRule ^(.*)$ domain_B.com/$1

RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} domain_C.com$
RewriteCond %{REQUEST_URI} !domain_C.com/
RewriteRule ^(.*)$ domain_C.com/$1

When I typed domain_C.com into my browser address bar, it searched but could not find the server for domain_C.com.

I figured the code in the .htaccess file that worked for one domain should work for another.
Does it take a certain amount of time after one registers a domain for it to start working. I've only just registered domain_C.com a couple hours ago.

I've tried the above code in the .htaccess file with no space in between blocks of code (domain_B works, domain_C doesn't), I've tried putting the domain_C code first, same result.

Any suggestions or input?

Thanks in advance.

Dennis

droliff
01-18-2009, 04:13 PM
Hi all,

My question posted here has just been answered.... through patience, lol.

I registered the new domain name yesterday (Sat. 1/17/09) (domain_C.com for reference). I then got to
work as described putting together a nice 'coming soon' html page, put the domain_C.com folder into my Verio hosting root directory and added another block of mod_rewrite code to the .htaccess file in the root directory.
All this within a couple hours of registering the domain. After typing 'domain_C.com'. into my browser I was getting 'server not found' alerts.
Well, it's now Sunday 1/18/09, 11 AM. I've just typed in 'domain_C.com' and......voila! my 'coming soon' page pops up. I guess it takes a certain amount of time after registering for the domain name to 'validate'. I'm not quite sure how that works. But I now know that I can 'sub-host' ,if you will, as many satellite websites as I'd like using this .htaccess code. The only minor glitch for the people that I am 'sub-hosting' for is that there can be no POP email accounts for the site i.e. info@domain_C.com.
But I can always link that text to the owners personal email if they'd like using the html <emailto:> tag.

Thanks for all who viewed this question. I hope that the answer I have found through a bit of patience in waiting will be of some help to others.

Again I'd like to give a shout out to Schleppel and Rmedek for helping me with the initial code.

Best,

Dennis



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum