.htacess problem - directories changed into site-names

.htacess problem - directories changed into site-names

am 13.07.2007 19:15:39 von Frank Ehrlacher

Hi,

and sorry for my english first.

I'm using .htacess to rewrite dynamic php-sites into static ones (htm)
Example:
dir1/sideXY.htm ist redirected to site.php?id=XY
using (.htacess in dir1):
RewriteEngine on
Options FollowSymLinks
RewriteRule ^site(.*)\.htm$ /dir1/site.php?id=$1 [L]
This works perfectly.

Now I wanna have rewriten "virtual" directories ...
Example:
dir1/dirXY/ should be rewritten into /dir1/site.php?id=$1 [L]
At the same time "old" requests to dir1/sideXY.htm should be rewritten to
the new dir1/dirXY (via 301) too.

What I tried is (changed .htacess in dir1):
Options FollowSymLinks
RewriteRule ^side(.*)\.htm$ /dir1/$1/ [R=301]
RewriteRule ^dir1/(.*)/$ /dir1/site.php?id=$1 [L]

The first line works, /dir1/sideXY/ appears in browser's URL-field.
But then it gets a "404" "Side missing" - so the 2nd line doesn't seem to
work?

Is there one thing I didn't see?

Thanks for Your help!