httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike <>
Subject [users@httpd] Apache Trailing Slash Fix not working on sub-domain rewrites.
Date Sun, 23 May 2004 05:33:28 GMT
My research has not yielded any solutions. I have tried official Apache 
1.3 doc's, Google, and several other related websites without success.

The URL rewrites to directories under my site's sub-domains break when 
no trailing slash is used. I am on a virtual hosting account which 
allows any .htaccess directive including rewrites, but I cannot view or 
modify the httpd.conf or other daemon config files...
    * (without trailing slash) - Works
        ...The trailing slash is added in a rewrite.
    * (without trailing slash) - 

This is what I have setup:
    # Setup URL Rewriting
    RewriteEngine on
    RewriteBase /
    # Begin Request Evaluations
        RewriteCond %{HTTP_HOST} ^www\.website\.com$ [NC,OR]
        RewriteCond %{HTTP_HOST} ^website\.com$ [NC]
    RewriteRule ^.*$    -    [L]
    # Request not for a sub-domain. Stop here.
    # Evaluate: subdomain1
        RewriteCond %{HTTP_HOST} ^subdomain1\.website\.com$ [NC]
        RewriteCond $1    ^(.+)$
    RewriteRule ^(.*)$ /home/username/webroot/subdomain1/%1 [NS,L]
    # Stop here.
    # Setup URL Rewriting
    RewriteEngine on
    RewriteBase /
    # Fix Absent Trailing Slash
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteCond %{HTTP_HOST}    ^(.+)$ [NC]
    RewriteRule ^(.+[^/])$    $1/ [R]
    # Stop here.

I (unsuccessfully) tried applying the Fix from the Apache 1.3 URL 
Rewriting Guide []. I 
have also tried many variations of the fix all without success.

I googled the words "trailing slash fix subdomains" and found which explained "This 
missing trailing slash problem would normally be fixed by Apache 
mod_dir, but it's possible that your host has UseCanonicalName on, which 
often causes this problem."

I asked my server admin and UseCanonicalName is turned ON in httpd.conf. 
I am only 1 user with a virtual account so I cannot ask that 
UseCanonicalName be turned off.

The forum explanation offered a fix based upon the assumption that all 
files would have ( extensions. My website runs certain scripts 
which have no file extensions so that would not be a viable solution. I 
think the Trailing Slash Fix from the Apache 1.3 URL Rewriting Guide's 
technique of checking if a request is a directory with "RewriteCond 
%{REQUEST_FILENAME} -d" would be a better approach.

If someone is familiar with a website or solution to this problem, it 
would be of great help. I am hoping someone might be able to point me in 
the right direction, suggest an alternate approach, or identify where I 
have made a mistake.

My server is running...
 Server OS: FreeBSD 4.3-RELEASE
Web Daemon: Apache/1.3.26 (Unix) FrontPage/ mod_fastcgi/2.2.12

Thank you for your time and attention.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message