Last active
February 13, 2018 08:10
-
-
Save simbo1905/f2ff8ead758faf9ed9e1f21ff3389cbc to your computer and use it in GitHub Desktop.
.htaccess write traffic to a subfolder to move a site into a subfolder
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
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{REQUEST_URI} !^/concrete575/ | |
RewriteRule (.*) http://www.mysite.net/concrete575/$1 [R=301,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was moving a concrete5 site installed into root ("/") onto a new hosted service where concrete5 was installed into a subfolder ("/concrete575").
This gist is a rewrite to send a 301 Moved Permanently to anything that doesn't have the prefix folder at the start of it.
The RewriteCond on line 4 matches request starting not with the subfolder because of the "!".
The RewriteRule captures the full path with
(.*)
and writes that as$1
at the end of the 301 redirect to the full site and path.