Skip to content

Instantly share code, notes, and snippets.

@tsu84
Created December 17, 2014 15:19
Show Gist options
  • Save tsu84/09588e690bbb0924bcf9 to your computer and use it in GitHub Desktop.
Save tsu84/09588e690bbb0924bcf9 to your computer and use it in GitHub Desktop.
Redirect HTTP from root to subdirectory
#setting for mysite.com linking to /subdir
RewriteEngine on
RewriteBase /
# Avoid Loop on directory
RewriteCond %{REQUEST_URI} !^/subdir/
# Rewrites all URLS [Replace "domain" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?mysite.com\.
# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /subdir/$1 [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment