Web Servers on Unix and Linux - [Apache] RewriteRules

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > June 2005 > [Apache] RewriteRules





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [Apache] RewriteRules
Glenn Kusardi

2005-06-16, 7:47 am

Hello,

I try to achieve the following in a .htaccess-file: If the URL is not
pointing on an existing file or directory it should be rewritten and be
executed by a script. If there are no matching rewrite rules the URL
should be given to the script with another parameter.

The following rules are working:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9\_\-]+)\.(html)$ index.php?seite=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9\_\-]+),([0-9]+)\.(html)$
index.php?seite=$1&navigation=$2 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?weiterleitung=$1 [L]

The rules apply to:

/test123.html -> /index.php?seite=test123
/test123,987.html -> /index.php?seite=test123&navigation=987
/testabc -> /index.php?weiterleitung=testabc

But: The request of /testabc/ is ending in an infinite loop. Is there a
solution to avoid this?

TIA,
Glenn

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com