httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krist van Besien <krist.vanbes...@gmail.com>
Subject Re: [users@httpd] mod_rewrite problem
Date Fri, 19 Aug 2005 08:57:55 GMT
On 8/19/05, Nick Gushlow <nick.gushlow@westcoast.co.uk> wrote:
> Hey guys,
> 
> I've got a working set of conditions and a rule, but I'm struggling to
> add another condition/rule.
> 
> The code below is working and turns any request for http://domain/word
> into http://domain/index.php?site=$1
> 
> RewriteLog /var/www/epp/logs/epp.rewrite.log
> RewriteLogLevel 9
> RewriteEngine on
> RewriteCond %{REQUEST_URI} !^.*\.php
> RewriteCond %{REQUEST_URI} !^.*\.gif
> RewriteCond %{REQUEST_URI} !^.*\.jpg
> RewriteCond %{REQUEST_URI} !^.*\.htm
> RewriteCond %{REQUEST_URI} !^.*\.html
> RewriteCond %{REQUEST_URI} !^.*\.css
> RewriteCond %{REQUEST_URI} !^.*\.js
> RewriteCond %{REQUEST_URI} !^.*\.doc
> RewriteCond %{REQUEST_URI} !^.*\.pdf
> # Rewrite URL
> RewriteRule /([^/]*)$ /index.php?epp=$1         [L]
> 
> 
> 
> I want to add a condition so that it skips the word abbey and continues
> as normal - eg http://domain/abbey just reads the abbey directory in
> htdocs - so I added
> 
> 
> RewriteCond %{REQUEST_URI} !^.*abbey(.*)

A better way to "short circuit" is just to add a 

RewriteRule  .*abbey.*    -   [L]

before the existing rule. This keeps the URL unchanged.

> It seems to partially work, in mozilla it seems to work, but in IE I
> just get page cannot be displayed.
> 
> Adding the trailing slash makes it work, so I'm guessing that mozilla
> has programming to auto try a trailing slash if it gets page not found.

If your apache is > 2.0.51 what happens when a user requests a URL not
ending in a slash that refers to a directory is that apache sends a
redirect to the correct location, wiith a slash.
(see docs for mod_dir)

> Question is, what is wrong with my condition/rules that apache is not
> adding the trailing slash?  -- note this is a virtual server and the
> other virtual servers on the same apache all handle the missing trailing
> slash so it's definitely something to do with my rewrite rules.

It will probably not be the rewrite rules, as you made them so that
nothing is done to the incoming URL when it contains the word abbey.


Krist

-- 
krist.vanbesien@gmail.com
Solothurn, Switzerland

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