Created
January 21, 2016 17:19
-
-
Save xikaos/b4f01ca7252ee7b52719 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteCond %{HTTP_HOST} ^example\.com$ [NC] # Here goes the regex to match the domain that will be redirected | |
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net$ [NC] # Create a new condition for every domain, if possible | |
RewriteRule ^(.*)$ http://www.example.it/$1 [R=301,NC,L] | |
# Force redirect to www | |
RewriteCond %{HTTP_HOST} ^example\.com$ | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,NC,L] | |
</IfModule> | |
# Prevent directory listing | |
Options -Indexes | |
# HTTP authentication | |
SetEnvIfNoCase Host example\.com$ require_auth=true # Define here the domain that should be authenticated | |
AuthType Basic | |
AuthName "Authentication message" # The message that appears to the user | |
AuthUserFile /home/example/site/.htpasswd # Set here the absolute path to htpasswd file | |
Order Deny,Allow | |
Deny from all | |
Satisfy any | |
Require valid-user | |
Allow from env=!require_auth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment