How restrict access to URLs with some special characters?

KRV

New Member
#1
I want to restrict access to URLs, which contain special characters ~ and '.

For example:

domain.com/blog~
domain.com/blog'
domain.com/blog/article~~~~~~~
domain.com/blog/article''''''''''''''''''''

What is the best solution to implement this on OpenLiteSpeed server?

The main task is to protect the website from malicious manipulation with URLs, fuzzing and enumeration, which can cause access logs to overflow with floods and loading server.

I use the following rule in "Context":

RewriteRule [^a-z/-] - [R=404]

But in this case, there are problems with access to administrative and service URLs.

Unfortunately, I did not find any working solutions on the Web. I'm tired of experimenting and trying different methods, maybe someone has already faced a similar case?
 

KRV

New Member
#2
Solution:

RewriteCond %{THE_REQUEST} \~
RewriteRule .* - [R=404]

RewriteCond %{THE_REQUEST} \'
RewriteRule .* - [R=404]
 
Top