• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved How to add custom rewrite rule for all web sites

lscpd

New Pleskian
Server operating system version
AlmaLinux 8.9
Plesk version and microupdate number
Plesk Obsidian 18.0.57.5
I want to add a custom rule that will be valid on all websites. I opened a topic on the litespeed forum and was directed here. What I want to do is to add a custom rule that will be valid on all existing and future websites.

 
You could add an event "Domain Created" by the Tools & Settings "Event Manager" to run a script that copies certain lines or a file into the domain's document root. Event handlers can use some variables. For details please see the documentation Event Handlers
 
You could add an event "Domain Created" by the Tools & Settings "Event Manager" to run a script that copies certain lines or a file into the domain's document root. Event handlers can use some variables. For details please see the documentation Event Handlers
Isn't it possible to do this by adding rules to httpd.conf or similar file? I have basic Linux knowledge.
<Files xmlrpc.php>
order deny,allow
deny from all
</Files>

What I'm looking for is how to run this code so that it is valid on all websites.
 
You mentioned you are using Litespeed and not Apache. As I don't know Litespeed well enough I cannot give advice on this, but maybe some other forum user who knows where and how to add rewrite rules to Litespeed on the server level sees the post and can help.
 
Reading trough the Litespeed documentation for Plesk I can see the /etc/httpd/conf.d/ (for RHEL bases systems) being mentioned as a location for custom configurations. May you can add a conf file with the rule there, and see if that works?

It was exactly what I was looking for. I created block_xmlrpc.conf in the /etc/httpd/conf.d/block_xmlrpc.conf directory and added

Code:
<Files xmlrpc.php>
order deny,allow
deny from all
</Files>

Code:
systemctl daemon-reload
service lsws restart

I ran the commands and everything is fine now :D Blocked example.com/xmlrpc.php for all websites.

Thank you. @Kaspar
 
Back
Top