-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htaccess
145 lines (119 loc) · 4.84 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
DirectoryIndex index.php index.html
# Block user from viewing list of files in a directory
Options -Indexes
IndexIgnore *
# Custom error pages
# Custom error message for a unauthorized page
ErrorDocument 401 /error/401/
# Custom error message for a forbidden page
ErrorDocument 403 /error/403/
# Custom error message for a page not found
ErrorDocument 404 /error/404/
# Custom error message for a internal server issue
ErrorDocument 500 /error/500/
# Stop users from viewing these folders/files
<Files /node_modules/>
Require all denied
</Files>
<Files .gitattributes>
Require all denied
</Files>
<Files .gitignore>
Require all denied
</Files>
<Files .htaccess>
Require all denied
</Files>
<Files gulpfile.js>
Require all denied
</Files>
<Files package.json>
Require all denied
</Files>
<Files README.md>
Require all denied
</Files>
RewriteEngine on
# Only follow the following rewriterules after this block only if file and directory doesn't exist
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [S=7]
# Add redirects for similar URLS to actual page/URL
RewriteRule ^about-me/?$ /about/ [R=301,NC,L]
RewriteRule ^contact-me/?$ /contact/ [R=301,NC,L]
RewriteRule ^portfolio/?$ /projects/ [R=301,NC,L]
RewriteRule ^sitemap/?$ /site-map/ [R=301,NC,L]
RewriteRule ^sitemap.xml?$ /site-map.xml [R=301,NC,L]
# Redirects for old API - used to be located within this project
RewriteRule ^api/(.*)$ https://api.jahidulpabelislam.com/$1 [R=301,NC,L]
RewriteRule ^api(.*)$ https://api.jahidulpabelislam.com/$1 [R=301,NC,L] # If no trailing slash
# Redirects for old Links page - used to be located within this project
RewriteRule ^links/(.*)$ https://links.jahidulpabelislam.com/$1 [R=301,NC,L]
RewriteRule ^links(.*)$ https://links.jahidulpabelislam.com/$1 [R=301,NC,L] # If no trailing slash
# Add caching for resources
<IfModule mod_headers.c>
# Cache specified static files for 1 year
<FilesMatch "\.(ico|jpg|jpeg|png|gif|css|svg|js)$">
Header set Cache-Control "max-age=31556952, public"
</FilesMatch>
# Cache specified files for 1 week
<FilesMatch "\.(html|php)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
AddType application/font-woff woff
AddType application/font-woff2 woff2
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttc ttf
AddType font/opentype otf
ExpiresByType image/gif "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg+xml "access 1 year"
ExpiresByType application/json "access 1 year"
ExpiresByType application/javascript "access 1 year"
ExpiresByType application/x-javascript "access 1 year"
ExpiresByType application/vnd.ms-fontobject "access 1 year"
ExpiresByType application/font-woff "access 1 year"
ExpiresByType application/x-font-woff "access 1 year"
ExpiresByType application/font-woff2 "access 1 year"
ExpiresByType application/x-font-woff2 "access 1 year"
ExpiresByType application/x-font-ttf "access 1 year"
ExpiresByType font/eot "access 1 year"
ExpiresByType font/opentype "access 1 year"
ExpiresByType font/woff2 "access 1 year"
ExpiresByType text/plain "access 1 year"
ExpiresByType text/css "access 1 year"
ExpiresByType text/javascript "access 1 year"
ExpiresByType text/html "access 1 week"
ExpiresByType text/cache-manifest "access plus 0 seconds"
</IfModule>
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
</IfModule>
</IfModule>