Skip to content

Instantly share code, notes, and snippets.

@vmrfriz
Created September 17, 2018 01:40
Show Gist options
  • Save vmrfriz/377274dc815a159ed8c0d788481d81e8 to your computer and use it in GitHub Desktop.
Save vmrfriz/377274dc815a159ed8c0d788481d81e8 to your computer and use it in GitHub Desktop.
.htaccess for multidomain site
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$ [NC]
RewriteCond %{REQUEST_URI} !^/%2/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /%2/$1
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$ [NC]
RewriteRule ^(/)?$ %2/index.php
</IfModule>
# Prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment