.htaccess multiple domains use www or non www

Use non www


# Multiple domains use non www
# Use non www; 21-02-2016
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteCond %{HTTP_HOST} (sub1.domain1.com|domain2.net|domain3.org)
RewriteRule ^(.*)$ "http://%0/$1" [R=301,L]

Use www


# Multiple domains use www
RewriteCond %{HTTP_HOST} !^www\.(.+)$ [NC]
RewriteCond %{HTTP_HOST} !(sub1.domain1.com|domain2.net|domain3.org)
RewriteRule ^(.*)$ "http://www\.%{HTTP_HOST}/$1" [R=301,L]

.htaccess auto include PHP script

Prepend and append PHP files with .htaccess

@ Automatically append or prepend files with a PHP script
@ How to append or prepend a file to PHP scripts using htaccess?

It is possible with PHP to automatically append or prepend a file to a script using the auto_append_file and auto_prepend_file configuration options. These options can be set in the .htaccess file.

The .htaccess code


# Prepend the file
php_value auto_prepend_file "/home/your_account/antispam.php"

# Append file
php_value auto_append_file '/home/content/abcxyz/12345679/html/your_library/your_script.php'

Htaccess file in Home Directory of HawkHost

<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# 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
</IfModule>

<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>

# For more information about HawkHost, visit their homepage.