views:

20

answers:

2

i have a successful use of mod_rewrite to make a site display as i wish... however, i have migrated the 'mock-up' folder to the root directory and in implementing these rules for the site, some files are not being served in the ^pdfs folder:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

(old directory)

RewriteRule ^redesign_03012010/mock-up/([^/]+)/([^/]+)$ /redesign_03012010/mock-up/index.php?page=$1&section=$2 [PT]
RewriteRule ^redesign_03012010/mock-up/([^/]+)$ /redesign_03012010/mock-up/index.php?page=$1 [PT,L]

(new directory)

RewriteRule ^([^/]+)/([^/]+)$ /index.php?test=1&page=$1&section=$2 [PT]
RewriteRule ^([^/]+)$ /index.php?test=1&page=$1 [PT,L]

... ^pdfs (aka /pdfs/) is not serving the files... any suggestions?

A: 

[L] flag asks mod_rewrite to stop processing the current set of rules, not the entire .htaccess file, so the following lines don't do what you need:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

You need to exclude existing files from being processed with mod_rewrite. Try using this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)$ /index.php?test=1&page=$1&section=$2 [PT]
RewriteRule ^([^/]+)$ /index.php?test=1&page=$1 [PT,L]
code ex machina
A: 
Lucas
i left the [L] in because it was causing things to break
Lucas