How to use RewriteRule in order to block out some directives, in .htaccess

kadrin

Active Member
Nov 13, 2019
34
6
8
Italy
cPanel Access Level
Website Owner
Block post request something liek this rule
Code:
# send all other post requests to 403 forbidden
RewriteRule ^ /editBlackAndWhite [F]
 

guldvog

Member
Mar 10, 2006
24
1
153
Ozamiz City, Philippines
cPanel Access Level
Root Administrator
:-DYAP!! :-D

There are two - alternative - approaches:

1. If you need to do a special redirect:

.htaccess
# I had to rewrite this section myself, to make certain that only the root part of the said domain would go to https:// ...
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} "/"
RewriteRule ^(.*)$ https://vps2x.guldvog.com.ph/$1 [R,L]
# send all other post requests to 403 forbidden
RewriteRule ^/editBlackAndWhite [F]
RewriteRule ^/sadad24 [F]
# The remains of this file is unchanged...
# -FrontPage-
IndexIgnore .htaccess /.?? ~ *# */HEADER /README /_vti
<Limit GET POST>
#The next line modified by DenyIP
order allow,deny
#The next line modified by DenyIP
#deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
...

2. If only a standard redirect:

.htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# send all other post requests to 403 forbidden
RewriteRule ^/editBlackAndWhite [F]
RewriteRule ^/sadad24 [F]
...
 
  • Like
Reactions: cPanelLauren
Thread starter Similar threads Forum Replies Date
Spiral Web Applications 4
B Web Applications 0