httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eskil Kvalnes" <>
Subject [users@httpd] mod_rewrite: rewriterule assistance
Date Wed, 03 Mar 2004 13:08:18 GMT

This is what I'm trying to achieve using mod_rewrite: =>
index.php?folder=/Bakgrunner/Razorart_Wallpapers/ => index.php?folder=/Bakgrunner/ =>
index.php?folder=/Bakgrunner/Razorart_Wallpapers/&image=Chemlab.jpg =>
index.php?folder=/&image=Picture_031.jpg =>

Folder can be multiple directories (/dir1/dir2/dir3/dir4/etc/), but it can
also be only one, like /.
Image is always last in the url, preceded by a folder.
Page is also always last, in this format: Page_x/, preceded by a folder

Contents of .htaccess:

RewriteEngine on
RewriteBase /
Options +FollowSymlinks -Indexes
RewriteRule ^.htaccess$ - [F]
RewriteRule css/style.css$ css/style.css [L]
RewriteRule images/(.*)$ images/$1 [L]
RewriteRule gallery/(.*)$ gallery/$1 [L]
RewriteRule ^(.*)/(.*)/Page_(.*)$ index.php?folder=$1&image=&page=$3
RewriteRule ^(.*)/(.*)$ index.php?folder=$1&image=$2

When accessing, everything
works fine:

    [folder] => Bakgrunner/Razorart_Wallpapers
    [image] => Chemlab.jpg

Same when accessing

    [folder] => Bakgrunner/Razorart_Wallpapers
    [image] =>

but when I access, Page_2/ gets
translated as a folder:

    [folder] => Bakgrunner/Page_2
    [image] =>

instead of:

    [folder] => Bakgrunner
    [image] =>
    [page] => 2

And when accessing, I get a
HTTP 404.

Thanks for your time,
Eskil Kvalnes

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message