Skip to content

Instantly share code, notes, and snippets.

@basherr
Created December 29, 2017 10:13
Show Gist options
  • Save basherr/1310d1f538784197b76b807a26dc277b to your computer and use it in GitHub Desktop.
Save basherr/1310d1f538784197b76b807a26dc277b to your computer and use it in GitHub Desktop.
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.abc.com [L,R=301]
# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^old.abc.com$
RewriteRule !^oldwordpress/ oldwordpress%{REQUEST_URI} [L]
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?abc.com$
# Change ‘subdirectory’ to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/ng2-abc/
# Don’t change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change ‘subdirectory’ to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /ng2-abc/$1
# Change example.com to be your main domain again.
# Change ‘subdirectory’ to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?abc.com$
RewriteRule ^(/)?$ ng2-abc/index.html [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment