How restrict access to URLs with some special characters?


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

For example:'''''''''''''''''''''

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?


New Member

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

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