Re: [users@httpd] mod_rewrite problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/19/05, Nick Gushlow <nick.gushlow@xxxxxxxxxxxxxxx> 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@xxxxxxxxx
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux