Skip to content

Instantly share code, notes, and snippets.

@tansautn
Last active April 29, 2018 05:52
Show Gist options
  • Save tansautn/4feeb3eb2b3dd466bcaf6531c830726f to your computer and use it in GitHub Desktop.
Save tansautn/4feeb3eb2b3dd466bcaf6531c830726f to your computer and use it in GitHub Desktop.
No "public" in the url .htaccess rewrite rules
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^public/ - [NC,L]
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>

What is this Gist

Almost all PHP frameworks now recommend using the public directory as a starting point for receiving requests in the application. And set them as a "Document Root" configuration on your websever. However, it is not always possible to do this, especially when you use a shared hosting. This .htaccess file will help you.

Usuage

Just place this .htaccess file to your application root directory

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