-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
55 lines (40 loc) · 1.42 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
Options -MultiViews -Indexes
DirectoryIndex index.php index.html index.xhtml
DirectorySlash On
AddType text/css .css
AddType application/xml .xml .xbl .xsl
AddType application/javascript .js
AddType text/x-component .htc
#AddDefaultCharset utf-8
AddCharset utf-8 .html .xhtml .xml .xbl .css .js .txt
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css text/plain application/javascript application/xml application/xhtml+xml application/atom+xml
</IfModule>
#ErrorDocument 403 /
#ErrorDocument 404 /
php_flag magic_quotes_gpc off
php_flag short_open_tag off
RewriteEngine On
# no www subdomain
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1/$0 [R=301,L]
# need to rewrite the favicon and robots.txt
RewriteRule ^(robots\.txt|favicon\.ico)$ /front/$1 [NC,L]
# deny requests to any of the code
RewriteCond %{THE_REQUEST} /\.src [NC]
RewriteRule ^ - [F,L]
# stop on a real file or directory
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?.+?$ - [L]
# no trailing slash!
RewriteRule ^/?(.+?)/$ http://%{HTTP_HOST}/$1 [R=301,L]
# only way of passing the request line to php
RewriteCond %{THE_REQUEST} ^.+$
RewriteRule ^ - [E=REQUEST_LINE:%0]
# articles or the home page
RewriteCond %{REQUEST_URI} ^/([^/\?]+)?.*?$
RewriteCond %{DOCUMENT_ROOT}/.src/%1.php !-f
RewriteRule ^ /.src/article.php [L]
# any other page
RewriteRule ^/?([^/]+).*$ /.src/$1.php [L]