# Prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Prevent directory listings
Options All -Indexes
# SPA rewriting logic
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
</IfModule>
# Prevent access to specific path
# ErrorDocument 401 default
# ErrorDocument 403 default
# <Files admin.php>
# Order deny,allow
# Deny from all
# Allow from 192.168.0.123 localhost
# </Files>
Last active
April 15, 2021 05:54
-
-
Save cypar/a303e768fb61a2d9fd8d934bcb9c5a0a to your computer and use it in GitHub Desktop.
SPA .htaccess rewriting logic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment