any apache guru's in the house?
Discussion
I'm reaching the limits of my mod_rewrite knowledge.
Put simply, I need to configure apache so that I can point a number of domains at a single IP and then for apache to redirect to different URL's depending on the requesting domain name. RewriteMap and Rewritecond sound like the kiddies..
Example
www.abc.com redirect to www.wibble.com/c
www.def.com redirect to www.foo.com/b
www.ghi.com redirect to www.bar.com/a
I've been pulling my hair out over this. There are other ways (PHP), but I'd like to keep this purely in the apache domain rather than fiddling with scripts etc.
TIA
Steve
Put simply, I need to configure apache so that I can point a number of domains at a single IP and then for apache to redirect to different URL's depending on the requesting domain name. RewriteMap and Rewritecond sound like the kiddies..
Example
www.abc.com redirect to www.wibble.com/c
www.def.com redirect to www.foo.com/b
www.ghi.com redirect to www.bar.com/a
I've been pulling my hair out over this. There are other ways (PHP), but I'd like to keep this purely in the apache domain rather than fiddling with scripts etc.
TIA
Steve
You need to modify httpd.conf to use the virtual host directive e.g.
<VirtualHost www.somewebsite.com>
DocumentRoot /usr/local/etc/httpd/vhosts/somewebsite/
ServerName www.somewebsite.com
</VirtualHost>
<VirtualHost www.somewebsite.com>
DocumentRoot /usr/local/etc/httpd/vhosts/somewebsite/
ServerName www.somewebsite.com
</VirtualHost>
Hi Steve - still with that electricity company?
Following on from the last post, create the VHosts; the magic line you want in each Vhost is -
(for example in the www.abc.com VHost)
Redirect permanant / www.wibble.com/c
That should do the trick . You could use mod_rewrite, but this is a simple redirect, so no need.
-- A refugee from Star Internet
Following on from the last post, create the VHosts; the magic line you want in each Vhost is -
(for example in the www.abc.com VHost)
Redirect permanant / www.wibble.com/c
That should do the trick . You could use mod_rewrite, but this is a simple redirect, so no need.
-- A refugee from Star Internet
wildeep said:
You need to modify httpd.conf to use the virtual host directive e.g.
<VirtualHost www.somewebsite.com>
DocumentRoot /usr/local/etc/httpd/vhosts/somewebsite/
ServerName www.somewebsite.com
</VirtualHost>
Thanks, avoiding using virtualhosts (esp name based) since I'd have to configure around 200+ (well I could automate it.
Steve
To answer my own question, here's what I've done and it works a treat:
RewriteEngine on
RewriteMap redirector txt:/path/to/redirector.map
RewriteRule /*$ ${redirector:%{HTTP_HOST}} [R]
The the redirector.map simply contains
www.site1.com www.site1sreplacement.com/a_page.htm
www.site2.com www.site2sreplacement.com/another_page.htm
www.site3.com www.site3sreplacement.com/yet_another_page.htm
Steve
RewriteEngine on
RewriteMap redirector txt:/path/to/redirector.map
RewriteRule /*$ ${redirector:%{HTTP_HOST}} [R]
The the redirector.map simply contains
www.site1.com www.site1sreplacement.com/a_page.htm
www.site2.com www.site2sreplacement.com/another_page.htm
www.site3.com www.site3sreplacement.com/yet_another_page.htm
Steve
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff