Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MnMTech/37bc460d26d99ae91109 to your computer and use it in GitHub Desktop.
Save MnMTech/37bc460d26d99ae91109 to your computer and use it in GitHub Desktop.
.htaccess file to redirect traffic from web root into Laravel project sub directory
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# remove www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [NE,R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?hostname\.com$
RewriteRule !^projectname/public/ /projectname/public%{REQUEST_URI} [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment