-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
56 lines (40 loc) · 1.45 KB
/
.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
### Turn off magic quotes - doesn't work on this server
#php_flag magic_quotes_gpc Off
### Do only if the environmental variables module is installed
<IfModule mod_setenvif.c>
### Set spammers referral as spambot
SetEnvIfNoCase Referer darodar.com spambot=yes
Order allow,deny
Allow from all
Deny from env=spambot
</IfModule>
### Do only if rewrite is installed
<IfModule mod_rewrite.c>
### Start rewrite and set basedir
RewriteEngine on
RewriteBase /
### Rewrite without the trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
### Rewrite without www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [L,R=301,QSA,NC]
### Rewrite without index.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.php($|\ |\?)
RewriteRule ^ /%1 [L,R=301]
### Rewrite without .php extension
RewriteCond %{THE_REQUEST} \s/+(.*)\.php[\s?] [NC]
RewriteRule ^ /%1 [L,R=301]
### Rewrite only if no file link or dir exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
### Rewrite blog tag
RewriteRule ^blog/tag/([a-zA-Z0-9_-]+)$ /index.php?id=blog&tag=$1 [L,QSA]
### Rewrite blog entry
RewriteRule ^blog/([a-zA-Z0-9_-]+)$ /index.php?id=blog&entry=$1 [L,QSA]
### Rewrite experiments
RewriteRule ^experiments/([a-zA-Z0-9_-]+)$ /index.php?id=experiments&route=$1 [L,QSA]
### Rewrite anything else
RewriteRule ^([a-zA-Z0-9_-]+)$ /index.php?id=$1 [L,QSA]
</IfModule>