httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Whitmore" ...@spam.co.nz>
Subject [users@httpd] Rewriting the Trailing Slash
Date Mon, 05 May 2003 20:47:10 GMT
Hi there

I am trying to "fix the trailing slash problem" using rewrite, but the
examples given use RewriteBase which you can't use using vhosts.
Can anyone help? See my existing config below.

ie http://www.website1.com/blah  -> http://www.website1.com/blah/

If I use the

RewriteCond    %{REQUEST_FILENAME}  -d
RewriteRule    ^/(.*)$           $1/  [R]

then http://www.website1.com/blah ->
http://www.website1.com/home/username/blah/

As it can't remove the /home/username/  as you can't use RewriteBase at all.

Thanks
Craig Whitmore


The Directories are set as /home/username/website1.com
/home/username/website2.com etc
with vhost.map =

domain1.com /home/user1/www.website2.com
domain2.com /home/user1/www.website3.com
domain3.com /home/user2/www.website4.com

etc


<VirtualHost *>
        RewriteEngine on
         DirectoryIndex index.html index.htm default.htm default.html

        RewriteMap    lowercase    int:tolower
        RewriteMap    vhost        txt:vhost.map
        RewriteCond   %{REQUEST_FILENAME}  !^/cgi-bin/branding.pl
        RewriteCond   %{REQUEST_FILENAME}  !^/error
        RewriteCond   %{REQUEST_URI}  !^/icons/
        RewriteCond   %{HTTP_HOST}  !^$
        RewriteCond   ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$
        RewriteCond   ${vhost:%1}  ^(/.*)$
        RewriteRule   ^/(.*)$   %1/$1  [E=VHOST:${lowercase:%{HTTP_HOST}}]

        ScriptAlias /cgi-bin/ /hosting/cgi-bin/

      #rewriter to add in "banners etc"
      Action add-header /cgi-bin/branding.pl
      AddHandler add-header .html .htm .shtml

    </VirtualHost>


---------------------------------------------------------------------
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