-
Notifications
You must be signed in to change notification settings - Fork 18
/
.htaccess
30 lines (24 loc) · 840 Bytes
/
.htaccess
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
27
28
29
30
Options -MultiViews
RewriteEngine On
# Add trailing slash
# RewriteCond %{REQUEST_URI} !(/$|\.)
# RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
# Hide .git
RedirectMatch 404 /\.git
# Force HTTPS
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} !=on
RewriteCond %{REMOTE_ADDR} !=127.0.0.1
RewriteCond %{HTTP_HOST} !=localhost
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA]
# Home view
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^$ views/index.php [L,QSA]
# Rewrite views
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^([^/.]+)/?$ views/$1.php [L,QSA]
# Rewrite views with ID
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^([^/.]+)/([^/.?&]+)/?$ views/$1.php?id=$2 [L,QSA]