[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mod_rewrite : the weapon of mass-destruction.



Hi :)

I've been trying to learn mod_rewrite to do /anything/ and I'm failing. Please 
take pity on me, oh mighty ones ! ;)

I wanted to use mod_rewrite as a technology test, and to learn something new, 
but it has simply driven me to distraction... perhaps someone could help?

I have a woody box (installed yesterday) with vanilla Apache, and a customer 
who has three domain names, and hundreds of files in /www/maindomain.ext.  
They also own anotherdomain.ext and thirddomain.ext, and each domain has a 
seperate defaultindex page - site1.html, site2.html, site3.html.

What I want to do is use mod_rewrite to check the entire URI they requested, 
and "if  http://www.anotherdomain.ext/ or http://anotherdomain.ext is 
requested, then display site2.html" and so on for the third site.

Aside from

LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
RewriteEngine On
RewriteLog /var/log/apache/rewrite.log
RewriteLogLevel 9

I have this:

<VirtualHost 1.2.3.4>
 DocumentRoot /www/maindomain.ext
 ServerName maindomain.ext
 ServerAlias www.maindomain.ext.
 ServerAlias anotherdomain.ext
 ServerAlias www.anotherdomain.ext
 ServerAlias thirddomain.ext
 ServerAlias www.thirddomain.ext
 RewriteRule anotherdomain\.ext\/$ /site2.html
 RewriteRule thirdomain\.ext\/$ /site3.html
</VirtualHost>

This is just not doing it for me, and I see nothing in the log file (0 bytes, 
same permissions/owner as the other access.log/error.log which work fine)

In fact, even doing something simple like

RewriteRule ^/gdh.* http://www.google.com/

doesn't have the desired effect :/

I'd be very grateful for any suggestions!

Cheers,
Gavin.



Reply to: