-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.htaccess
More file actions
26 lines (20 loc) Β· 969 Bytes
/
Copy path.htaccess
File metadata and controls
26 lines (20 loc) Β· 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect requests not pointing to /public, /assets (for specific file types), to /public
RewriteCond %{REQUEST_URI} !^/public
RewriteCond %{REQUEST_URI} !^/assets/.*\.(css|js|png|jpg|jpeg|svg|json)$ [NC]
RewriteRule ^(.*)$ /public/$1 [L]
# Allow access to specific file types in /assets for all IPs
RewriteCond %{REQUEST_URI} ^/assets/.*\.(css|js|png|jpg|jpeg|svg|json)$ [NC]
RewriteRule ^(.*)$ - [L]
# Deny access to /assets for all other files except for IP 127.0.0.1
RewriteCond %{REQUEST_URI} ^/assets
RewriteCond %{REMOTE_ADDR} !=127.0.0.1
RewriteRule ^(.*)$ - [R=404,L]
# Custom error documents
ErrorDocument 400 /public/errors.php?error=400
ErrorDocument 401 /public/errors.php?error=401
ErrorDocument 403 /public/errors.php?error=403
ErrorDocument 404 /public/errors.php?error=404
ErrorDocument 500 /public/errors.php?error=500
</IfModule>