problems with mod_rewrite rules

A place to discuss the testing process in beta cycles or against SVN for the CMS Made Simple CORE package.
Locked
jelle

problems with mod_rewrite rules

Post by jelle »

Hi Forum,

The rewrite rules in docs/htaccess.txt appear not to work for my apache2 install, And I cant put the finger on why, so if anybody would be so kind to lend a hand....

Ok this is the situation:
Debian Sarge, Apache2.

In my virtualhost definition I have these rules, based on docs/htaccess:

Code: Select all

RewriteEngine On
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 8
#Rewrites page.html as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^/(.+)\.html$ index.php?page=$1 [QSA]

I rewrote the rule to include the slash in ^/(.+)html$, as without the /, the redirect resolved to  index.php?page=/home

Code: Select all

initial] (4) RewriteCond: input='/home.html' pattern='!-f' => matched
82.161.170.206 - - [17/Mar/2006:14:49:48 +0100] [heelsimpel.net/sid#80dc568][rid#81ef980/
initial] (2) rewrite /home.html -> index.php?page=/home
82.161.170.206 - - [17/Mar/2006:14:49:48 +0100] [heelsimpel.net/sid#80dc568][rid#81ef980/
initial] (3) split uri=index.php?page=/home -> uri=index.php, args=page=/home
82.161.170.206 - - [17/Mar/2006:14:49:48 +0100] [heelsimpel.net/sid#80dc568][rid#81ef980/
initial] (2) local path result: index.php


However I still get a 400 bad request when I try to acces with a clean url:

Code: Select all

82.161.170.206 - - [17/Mar/2006:15:02:14 +0100] "GET /fsck.html HTTP/1.1" 400 226 "http:/
/heelsimpel.net/index.php?page=fsck"

this request was correcly rewritten:

Code: Select all

 
82.161.170.206 - - [17/Mar/2006:15:02:14 +0100] [heelsimpel.net/sid#80dc580][rid#81ef9c0/
initial] (2) rewrite /fsck.html -> index.php?page=fsck


The thing that annoys me the most, is that I get an error, but no error is logged, even if I turn up the reporting level.
Any ideas or should I try banging my head against a wall?
odo
Forum Members
Forum Members
Posts: 10
Joined: Wed Jul 30, 2008 7:35 pm

Re: problems with mod_rewrite rules

Post by odo »

I hate those threads that describe EXACTLY the problem you have but no solution...well here's mine: After few hours of googling and Apache/php reinstall, turned out that one slash resolved my problem  :o

Code: Select all

RewriteRule ^(.+).html$ /index.php?page=$1 [QSA]
Locked

Return to “[locked] Quality Assurance”