-
Notifications
You must be signed in to change notification settings - Fork 2
/
.htaccess
25 lines (19 loc) · 837 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
RewriteEngine On
# Redirect HTTP traffic to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [L,R=301]
# Redirect external .php requests to extensionless url
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
#RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]
# Resolve .php file for extension-less php urls
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/.]+)$ $1.php [L]
# Format user variable
RewriteRule ^search/?([0-9a-zA-Z_-]+)/?([0-9a-zA-Z_-]+)?$ search.php?type=$1&data=$2
RewriteRule ^api/statistics?$ api/statistics.php
RewriteRule ^api/statistics/?([0-9a-zA-Z_-]+)?/([0-9a-zA-Z_-]+)?$ api/statistics.php?type=$1&data=$2
# 404 error
ErrorDocument 404 /errors/404.php