Skip to content

Instantly share code, notes, and snippets.

@sibinx7
Last active January 27, 2023 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sibinx7/53ed71dfed519a35f011220db5f4fb2d to your computer and use it in GitHub Desktop.
Save sibinx7/53ed71dfed519a35f011220db5f4fb2d to your computer and use it in GitHub Desktop.
Laravel 5 application on shared hosting without copying anything from public to root directory
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>
@sibinx7
Copy link
Author

sibinx7 commented Apr 19, 2016

  • Create a .htaccess file
  • Copy above lines to .htaccess file
  • Save it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment