johnstreet11
johnstreet11

Reputation: 21

How to edit .htaccess Server-wide

I use WHM for hosting which allows me to make many cpanel accounts. Every time I make a cpanel account it has a new .htaccess file inside public_html with the same code inside

I want to be able to change this code to mine but not on one cpanel but rather on all. so every new cPanel has my edited code automatically when made rather then editing it manually.

I cant seem to find the default .htaccess on my server. How can I go about doing this?

I use litespeed also.

tried to find the .htaccess config on server and inside whm

Upvotes: 1

Views: 294

Answers (1)

qtwrk
qtwrk

Reputation: 349

I think there is such thing as a "global htaccess"

for WHM/cPanel, the closest thing you can do is Include that can affect all vhost

not sure what you want to do with htaccess, but I assume it should also work in Apache conf file

e.g.

/etc/apache2/conf.d/userdata/ssl/2_4/deny.conf
/etc/apache2/conf.d/userdata/std/2_4/deny.conf

put content like

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} xmlrpc.php
RewriteRule .* - [F,L]
</IfModule>

restart Apache/LSWS, then this will make all vhost's /xmlrpc.php end up in 403 error.

ref: https://docs.cpanel.net/ea4/apache/modify-apache-virtual-hosts-with-include-files/

Upvotes: 0

Related Questions