Here is a method for configuring the whitelist using rewrite Rules in apache.
Today, I got apache rewrite Rules for half a day, but I still haven't configured any matching rules. My colleague gave me some advice and succeeded.
Requirements:
Six file portals, all others are redirected to the index
Your own ideas:
Regular expressions are used to find out the URL pattern of not six files and filter the URLs.
Comparing the results of colleagues, I have my own ideas:
1. If you want to find out all the rules that do not comply with the rules, the more you want, the more you cannot start. ---------------- Incorrect thinking. A whitelist should be created,
2. Incorrect concept. The basic concepts of REQUEST_URI and REQUEST_STRING are incorrect.
Final result:
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond % {REQUEST_URI} ^/$ RewriteRule ^ /(. *)/index. asp $1 [L] RewriteCond % {REQUEST_URI} ^/index. asp [NC, OR] RewriteCond % {REQUEST_URI} ^/o. asp [NC, OR] RewriteCond % {REQUEST_URI} ^/s. asp [NC, OR] RewriteCond % {REQUEST_URI} ^/error. asp [NC, OR] RewriteCond % {REQUEST_URI} ^/favicon. ico [NC, OR] RewriteCond % {REQUEST_URI} ^/status. taobao [NC, OR] RewriteCond % {REQUEST_URI} ^/app/thirdparty/webbox. asp [NC, OR] RewriteCond % {REQUEST_URI} ^/static/[NC] RewriteRule ^. *-[L] RewriteCond % {REQUEST_URI }! ^/Index. asp $ RewriteRule ^. *-[F, L] </IfModule>