In the beginning, I wanted to disable the URL of the php suffix directly from being accessed in the rewrite rules. But later found that the rewrite rules are recursively called. If php is directly disabled in the rewrite rules, the rules for rewriting to the php file will also be invalid. RewriteEngineOn
RewriteRule^test$/test.php[L]
RewriteRule^test.php$$0[F,L]
Recursive call This is terrible, at the beginning The URL rewrite is checked once when accessing /test, and then it is internally redirected to /test.php when it matches ^test$. However, internal redirection also triggers URL rewriting, so check again and match to ^test.php$. It was forced to operate directly [F] (Forbidden), so it became a 403 error. In this case, you must determine whether you have been redirected by the server. At this time there is a REDIRECT_URL in the server variable that can be used, so I tried to use this to make a judgment.
RewriteEngineOn
RewriteRule^test$/test.php[L]
RewriteCond%{REDIRECT_URL}^$
RewriteRule.*$0[F, L] This write access /test is still 403, a little check, found that RewriteCond %{REDIRECT_URL} is always empty, this is a pain, so there is no way to directly ban php in the rewrite rules. But it can be done in a less expensive way. It is to judge REDIRECT_URL in the php file. Although this method can be implemented, it feels very inferior, but it has not found any better way so far.
$_SERVER['REDIRECT_URL']ordie('Forbidden');
//This is just a display of the text, and the HTTP error code to be output when actually used.
echo$_SERVER['REDIRECT_URL'];//Successfully access the display information
?>
Put this PHP code into the global reference and modify it. There is no problem with it. Although it is not a perfect solution, it is at least solved. In the future, you may find a better way.
with Hpyer-V Why choose Microsoft Private Cloud In the enterprise, the deployment of private clouds
When deploying the WCF server in the IIS server in Windows Server 2008, the following error is repor
Anyone who knows about the network knows that dual network cards can
Problem Description: T220 G5B module fan is bad, how to turn off the alarm sound? Module model: 8880
How much do you know about Windows Server Hardening?
Briefly use linux to build www server (2)
IIS W3SVC service due to performance counter error and crashed
Exchange administrator needs to know the DST data summary
Weapons: Data Center Migration Beware of Four Big Mistakes
Windows2003 server management three skills
Perfect solution for IIS server unable to load application
Webservice asynchronous callback, causing data binding failure, resulting in server problems
Government agencies server software full Raiders operating system articles
Automatic backup of website and database scripts under CentOS
Hypervisor choose one: Which is better for you?
Analyze the advantages and disadvantages of network storage categories
Linux (centos) SSH installation and setup - macos remote connection
What is the built-in version of Internet Explorer for Windows 7?
Apple counterattacks Siri service lawsuit as its cutting-edge technology
How does Win8.1 disable the "URL input association function" in IE11 browser?
How to set the default input method for win8 computer
Creating a personalized Win8 change Win8 startup background began
Windows 2003 as a transit VPN server multi-route sharing Internet access method
What should I do if there are two user accounts on Win10 boot?
Go to the computer city to find an E3 plus a B85
Skip Win7/8 Upgrade Direct new installation and permanent activation of Win10 tutorial