I made a website before and used rewriting to achieve pseudo-static. Today I want to add a blog function, but I found a problem. The previous rewriting rewritten "(w)/", and now / blog/ also cannot be opened, because the system does not treat /blog/ as an access to a folder, but as a parameter in the rewrite. I was already trembling about the rewrite, so I searched for a long time and finally found one. Method, record it and make a note:
# Do not rewrite the subdirectory directory
RewriteEngine On RewriteBase /
RewriteCond %{REQUEST_URI} ^/subdirectory/(.*)$
RewriteRule ^. *$ - [L]
RewriteEngine on RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [ L]
Add one more example:
# Do not forward directories or files with google prefix
RewriteEngine On RewriteBase /
Rewrite Cond %{REQUEST_URI} ^/google( .*)$
RewriteRule ^.*$ - [L]