Skip to content

Instantly share code, notes, and snippets.

@martiuh
Last active December 8, 2018 17:30
Show Gist options
  • Save martiuh/746f00746d23b5fe02f02fb374cacd9e to your computer and use it in GitHub Desktop.
Save martiuh/746f00746d23b5fe02f02fb374cacd9e to your computer and use it in GitHub Desktop.
.htaccess root as folder
# Map http://www.example.com to /public.
RewriteRule ^$ /public/ [L]
# Map http://www.example.com/x to /public/x unless there is a x in the web root.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1
# Add trailing slash to directories within public
# This does not expose the internal URL.
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^public/(.*[^/])$ http://curiontas.com/$1/ [R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment