Created
September 29, 2016 15:56
-
-
Save mocanuga/6ba525ee9f6aaed6d11cac8d2e2cae82 to your computer and use it in GitHub Desktop.
Ajax request detection in htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ErrorDocument 404 NotFound | |
ServerSignature Off | |
Options +FollowSymLinks | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_METHOD} ^(GET)$ | |
RewriteCond %{HTTP:X-Requested-With} XMLHttpRequest [NC] # i had to add no case to work | |
RewriteRule ^(.*)$ script.php?url=$1&get=true [NC,L,QSA] | |
RewriteCond %{REQUEST_METHOD} ^(POST)$ | |
RewriteCond %{HTTP:X-Requested-With} XMLHttpRequest [NC] | |
RewriteRule ^(.*)$ script2.php?url=$1&post=true [NC,L,QSA] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment