Skip to content

Instantly share code, notes, and snippets.

@hellotunmbi
Last active April 3, 2021 15:12
Show Gist options
  • Save hellotunmbi/6a51ee0d89fd66be55745aa2b5f5165c to your computer and use it in GitHub Desktop.
Save hellotunmbi/6a51ee0d89fd66be55745aa2b5f5165c to your computer and use it in GitHub Desktop.
Options -Indexes
Options +FollowSymLinks
# Set the default file for indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
# activate URL rewriting
RewriteEngine on
# do not rewrite links to the documentation, assets and public files
RewriteCond $1 !^(index\.php|public|robots\.txt)
# do not rewrite for php files in the document root, robots.txt or the maintenance page
RewriteCond $1 !^([^\..]+\.php|robots\.txt|sitemap\.xml)
# but rewrite everything else
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment