Bulk Overwrite .htaccess file in all user accounts?
Hi ,
I have a got a nice idea about the .htaccess file optimization but I am unable to proceed.
I have one file .htaccess in my server's root location but I want to copy or replace to all the cpanel user's home location i.e home/user/.htaccess
If Any body have the solution I will be too happy to complete these task
.htaccess content for this thread reader also if anyone wants to suggest on this :
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
# BEGIN Expire headers
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
# BEGIN Cache-Control Headers
Header set Cache-Control "public"
Header set Cache-Control "public"
Header set Cache-Control "private"
Header set Cache-Control "private, must-revalidate"
# END Cache-Control Headers
# END Expire headers
Order allow,deny
Deny from all
Satisfy All
Header set Connection keep-alive
ServerSignature Off
Options -Indexes
-
Hello, Replacing the existing .htaccess files is not recommended. These files may already include entries related to features offered in cPanel & WHM (e.g. MultiPHP, Redirects, Optimize Website). This is generally something you'd want to handle on a per account basis. Thank you. 0 -
Dear, I am respecting the codes inside the cpanel root and adding some other codes too for optimization thats why I need the command to run in ssh, if you could help me I will be highly appreciated ! 0 -
Hello, That level of modification would involve developing a custom bash script that searches for the .htaccess files and appending those files with a specific entry. I recommend reaching out to a qualified system administrator for help with this, as it's outside the scope of support we can offer: Thank you. 0 -
It looks like at least some of what he's wanting to include in his .htaccess files could go in Home -> Service Configuration -> Apache Configuration -> Include Editor -> Previrtual Host Include -> All Versions. Would that work? 0 -
Yeah @cPanelMichael will it work ? 0 -
It looks like at least some of what he's wanting to include in his .htaccess files could go in Home -> Service Configuration -> Apache Configuration -> Include Editor -> Previrtual Host Include -> All Versions. Would that work?
Yes, that is one alternative and matches the steps referenced by another customer at: Thank you.0
Please sign in to leave a comment.
Comments
6 comments