httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Malo ...@perlig.de>
Subject Re: [users@httpd] Removing an extra slash from redirected URLs
Date Mon, 23 Feb 2004 06:46:17 GMT
* "Andy Kavanagh" <andyk@lofi-gaming.org.uk> wrote:

>>> This is my current code:
>>> 
>>> RewriteEngine on
>>> RewriteBase   /  
>>> RewriteRule   ^(.*)\.shtml$              $1      [C,E=WasHTM:yes]
>>> RewriteCond   %{REQUEST_FILENAME}.php -f
>>> RewriteRule   ^(.*)$ $1.php                   [S=1,R]
>>> RewriteCond   %{ENV:WasHTM}            ^yes$
>>> RewriteRule   ^(.*)$ $1.shtml
>> 
>> Yes. Preceding the replacement with the slash yourself should 
>> help. Like:
>> 
>> RewriteRule   ^(.*)\.shtml$ /$1 [C,E=WasHTM:yes]
> 
> Hmmm.  That gives me a 500 internal server error whenever I request a
> .shtml page now :(

doh!

Well, let's try to rewrite (pun intended :-) your rules:

RewriteEngine on
RewriteBase   /
RewriteCond   %{REQUEST_FILENAME} (.*)\.shtml$
RewriteCond   %1.php              -f
RewriteRule   ^(.*)\.shtml$       /$1.php [R]

(untested, no good testing server here, sorry)

btw, when working with mod_rewrite, it's always helpful to install a local
server and test rules at home with RewriteLog enabled.

HTH, nd

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