Possible to do a subdomain redirect by an explicit mod_alias redirect statement? Is there a way
around mod_rewrite mangling (i.e. rewriting) the relative links in code under the subdomain folder?
Attempts to accomplish an internal redirect of a subdomain <a style='text-decoration: underline;' href="http://ChurchOfGod.Churches.org" target="_blank">http://ChurchOfGod.Churches.org</a>
to <a style='text-decoration: underline;' href="http://www.Churches.org/ChurchOfGod" target="_blank">http://www.Churches.org/ChurchOfGod</a> break relative links in the following manner:
[Mon Jul 21 22:54:40 2003] [error] [client 199.199.199.199] File does not exist:
/var/www/html/ChurchOfGod/css/
churches.css
The rewrite (see below) works to get me to the right subdirectory, but then pathnames to relative
links and includes are mangled. The actual relative link above should have been
"/var/www/html/css/churches.css" and of course fixing the link for the rewrite would break them
for code under <a style='text-decoration: underline;' href="http://www.churches.org/ChurchOfGod" target="_blank">www.churches.org/ChurchOfGod</a>
I'm guessing this is a common problem, but I'm missing something in my interpretation of relavant
previous posts. Is a php or cgi script required (same problems likely?) or could some combination
of NameVirtualHost or mod_alias handle it?
>
>On Fri, 18 Jul 2003 22:06:36 -0400, Jones <jones.DeleteThis@justjones.org> wrote:
>>Can you please describe a strategy for accomplishing the following?
>> redirect <a style='text-decoration: underline;' href="http://ChurchOfGod.Churches.org" target="_blank">http://ChurchOfGod.Churches.org</a> to <a style='text-decoration: underline;' href="http://" target="_blank">http://</a> <a style='text-decoration: underline;' href="http://www.Churches.org/ChurchOfGod" target="_blank">www.Churches.org/ChurchOfGod</a>
>v
>Per your hint to look at mod_rewrite to implement "User Virtual Hosts"
>I was able to implement subdomains using that method, *but* I have
>to duplicate the [unknown] way subdomains were implemented on another
>box to accomodate someone else's code. This method resulted in an
>extra subdomain name being put in all the includes and relative links,
>so <a style='text-decoration: underline;' href="http://www.Churches.org/ChurchofGod" target="_blank">www.Churches.org/ChurchofGod</a> works great, but ChurchofGod.Churches.org
>gets me to the right subdirectory, but then all relative links and includes are
>broken. that is: It results in includes which should look like this
>
>../images or ../includes
>
>showing up in the error_log as file not found ../ChurchOfGod/images
>or ../ChurchOfGod/includes, etc.
>v
>Is there another way? I need to 2nd guess someone else's implementation
>of subdomains.
>
>RewriteEngine on
>RewriteCond %{HTTP_HOST} [^.]+\.churches\.org$
>RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
>RewriteRule ([^.]+)\.churches\.org(.*) /$1$2
>
>#
># This should be changed to whatever you set DocumentRoot to.
>#
><Directory "/var/www/html">
><!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: [subdomain redirect without breaking pre-existing relative..