[Apache] mod_rewrite www.site.com/dir/ --> www.site.com/dir/2009/
- by Casey
I'm having trouble with this rewrite. I've never really used mod_rewrite before and don't have much experience with regex. Any help is appreciated!
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
#prevent nested looping
RewriteCond %{ENV:REDIRECT_STATUS} ^$
#re-route incoming requests
RewriteRule ^(.*)$ %{REQUEST_URI}2009/$1 [L,NE]
</IfModule>
This partially works, http://www.site.com/dir/ is routed to http://www.site.com/dir/2009/ but a request like http://www.site.com/dir/css/theme.css fails. I'm hoping to rewrite all requests to the parent directory into the 2009 subdirectory but I keep encountering infinite loops and server errors messages. I haven't found any useful examples out there. I figured this would be a common rewrite...
Thanks in advance!