httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Andersson" <rob...@profundis.nu>
Subject Re: [users@httpd] Apache Trailing Slash Fix not working on sub-domain rewrites.
Date Wed, 26 May 2004 14:27:59 GMT
Mike wrote:
>     * http://subdomain1.website.com/directory (without trailing slash) -
> Breaks
>         ...Becomes http://website.com/subdomain1/directory/

Although it might be possible to fix with .htaccess (I'm not sure, however),
you should talk with your hosting company. What you see is a flaw in their
configuration and in their way to support "subdomains". They should be able
to tell you more as they are (or should be) familiar with their
configuration.

Most likely they are using mod_rewrite to map the subdomain to a
subdirectory. When the trailing slash is missing, it makes an external
redirect using the real servername and the already rewritten path. It might
not be possible for you to do anything inbetween. A very inefficient
workaround might be to have this in an .htaccess in the main site's root:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} website\.com
    RewriteCond %{REQUEST_URI} /(subdomain1|subdomain2)/
    RewriteRule ^([^/]+)/(.*) http://$1.website.com/$2 [R,L]

That is, if it is a "broken" redirect, redirect to the correct URI. Note
that this will redirect the client twice!

Of course, it all depends on the exact configuration your hosting provider
uses.

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message