-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.html
More file actions
501 lines (412 loc) · 20.9 KB
/
index.html
File metadata and controls
501 lines (412 loc) · 20.9 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Free .htaccess Online Generator</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
<style>
body {
padding-top: 2rem;
padding-bottom: 2rem;
}
h3 {
margin-top: 2rem;
}
h2 {
font-size: 1.45rem;
margin-top: 2rem;
margin-bottom: 2rem;
}
form {
padding-left:10px;
}
.row {
margin-bottom: 1rem;
}
.row .row {
margin-top: 1rem;
margin-bottom: 0;
}
[class*="col-"] {
padding-top: 1rem;
padding-bottom: 1rem;
background-color: rgba(86,61,124,.15);
border: 1px solid rgba(86,61,124,.2);
}
hr {
margin-top: 2rem;
margin-bottom: 2rem;
}
.lead, small {
padding-left:10px;
}
footer {padding: 2rem;}
</style>
<!-- Google Tag Manager DELETE -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K8V5396');</script>
<!-- End Google Tag Manager DELETE -->
</head>
<body>
<div class="container">
<h1>Free .htaccess Generator</h1>
<p class="lead">Simple, free and online. Create, without error, your .htaccess file.</p>
<hr>
<h3>Instructions</h3>
<p>Fill the options and push "generate" button in order to get your .htaccess file. The copy and paste the content into your .htaccess file. Remember, this file must be in the root of your site.</p>
<form>
<h2>Public access options</h2>
<div class="form-group">
<label for="htDomain">Domain</label>
<input type="text" class="form-control" id="htDomain" aria-describedby="Domain" placeholder="Enter domain">
<small id="domainHelp" class="form-text text-muted">Example: domain.com (don't use www or http)</small>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htHttps" class="form-check-input">
Redirect http to https (SSL)
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htWww" class="form-check-input">
Force www access (default is non www)
</label>
</div>
<br/>
<h2>Config website</h2>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="ht404Redirect" class="form-check-input">
Prevent 404 errors for non-existing folders
</label>
</div>
<br/>
<div class="form-group">
<label for="htDefaultPage">Default access page</label>
<input type="text" class="form-control" id="htDefaultPage" aria-describedby="Default page" placeholder="Enter default page (file)">
<small class="form-text text-muted">Example: index.php index.html (default is index.html)</small>
</div>
<div class="form-group">
<label for="htWebCharset">Default web charset</label>
<input type="text" class="form-control" id="htWebCharset" aria-describedby="Web charset" placeholder="Enter default charset">
<small class="form-text text-muted">Example: UTF-8</small>
</div>
<div class="form-group">
<label for="htForceDownload">Force download (filetype)</label>
<input type="text" class="form-control" id="htForceDownload" aria-describedby="Force download" placeholder="Enter files to force download when access">
<small class="form-text text-muted">Example: .avi .pdf .mp4</small>
</div>
<div class="form-group">
<label for="htFileSize">Limit upload file size</label>
<input type="text" class="form-control" id="htFileSize" aria-describedby="File size" placeholder="Enter maximun file size in bytes">
<small class="form-text text-muted">Example: 2147483647 (2GB)</small>
</div>
<div class="form-group">
<label for="htAdminEmail">Administrator email</label>
<input type="text" class="form-control" id="htAdminEmail" aria-describedby="Admin email" placeholder="Enter default contact email">
<small class="form-text text-muted">Example: webmaster@domain.com</small>
</div>
<h2>Performance</h2>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htGzip" class="form-check-input">
Enable Gzip compression
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htKeepAlive" class="form-check-input">
Enable Keep-Alive header
</label>
</div>
<br/>
<div class="form-group">
<label for="htExpiresHeaders">Expires Headers</label>
<input type="text" class="form-control" id="htExpiresHeadersFormat" value="flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav">
<div class="form-row">
<div class="col-10" style="background-color:white; border:0;">
<input type="text" class="form-control" id="htExpiresHeaders" aria-describedby="Expires headers" placeholder="Set the time for headers to expire (seconds)">
<small class="form-text text-muted">Example: 29030400</small>
</div>
<div class="col-md-2" style="background-color:white; border:0;">
<select class="form-control" onchange="$('#htExpiresHeaders').val($(this).val());">
<option>Time helper</option>
<option value="1800">30 min</option>
<option value="3600">1 hour</option>
<option value="43200">12 hours</option>
<option value="86400">1 day</option>
<option value="604800">1 week</option>
<option value="2419200">1 month</option>
<option value="29030400">1 year</option>
</select>
</div>
</div>
</div>
<h2>Custom errors pages</h2>
<div class="form-group">
<label for="htCustomError404">Error 404</label>
<input type="text" class="form-control" id="htCustomError404" aria-describedby="Custom 404" placeholder="Enter default 404 url">
<small class="form-text text-muted">Example: error404.html</small>
</div>
<div class="form-group">
<label for="htCustomError500">Error 500</label>
<input type="text" class="form-control" id="htCustomError500" aria-describedby="Custom 500" placeholder="Enter default 500 url">
<small class="form-text text-muted">Example: error500.html</small>
</div>
<h2>Security</h2>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htDirectory" class="form-check-input">
Prevent directory navigation
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htDisableCgi" class="form-check-input">
Disable CGI execution
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htDisableTech" class="form-check-input">
Hide information about web server technology
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htDisableFrame" class="form-check-input">
Do not allow pages to be framed
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htDisableSign" class="form-check-input">
Disable server sign
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htSpamBots" class="form-check-input">
Block SPAM bots
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" id="htIllegal" class="form-check-input">
Prevent illegal or unsafe access (restrictive mode)
</label>
</div>
<br/>
<div class="form-group">
<label for="htDisallowScript">Disallow script execution</label>
<input type="text" class="form-control" id="htDisallowScript" aria-describedby="Disallow Script" placeholder="Enter scripts to prevent the execution">
<small class="form-text text-muted">Example: .php .jsp .cgi</small>
</div>
<div class="form-group">
<label for="htDenyRequests">Deny requests methods</label>
<input type="text" class="form-control" id="htDenyRequests" aria-describedby="Disallow request" placeholder="Enter methods to deny">
<small class="form-text text-muted">Example: get|post|put</small>
</div>
<div class="form-group">
<label for="htHotlinking">Prevent hotlinking</label>
<input type="text" class="form-control" id="htHotlinking" aria-describedby="Prevent hotlinking" placeholder="Enter full image URL you want to show when someone uses your hosted images">
<small class="form-text text-muted">Example: https://mydomain.com/mylogo.png</small>
</div>
<br/><br/>
<button type="button" id="generateHtaccess" class="btn btn-primary">Generate .htaccess</button>
</form>
<br/>
<textarea id="htaccessFinal" rows="15" class="form-control"></textarea>
<footer class="text-center">Created by <a id="authorLink" target="_blank" href="https://emirodgar.com">Emirodgar</a> / Salamanca (Spain) / 2018 - <b>Free htaccess generator</b></footer>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js" integrity="sha384-a5N7Y/aK3qNeh15eJKGWxsqtnX/wWdSZSKp+81YjTmS15nvnvxKHuzaWwXHDli+4" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script>
$('#generateHtaccess').click( function()
{
var htaccess = '';
var domain = $('#htDomain').val();
var domainReg = domain.replace(/\./g,'\\.');
if (domainReg =='') domainReg = 'CHANGEDOMAIN\\.com';
var param = paramHttps = htaccessIllegal = htaccessSpam = '';
var rewrite = false;
$('#htaccessFinal').val('');
htaccess += '\nRewriteEngine On';
if ($('#htHttps').is(":checked"))
{
paramHttps = 's';
htaccess += "\n\n#Redirect to SSL version"+
"\nRewriteCond %{HTTPS} off" +
"\nRewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}";
}
if ($('#htWww').is(":checked")) {
htaccess += "\n\n#Redirect to www version"+
"\nRewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]" +
"\nRewriteRule ^(.*)$ http"+paramHttps+"://www.%{HTTP_HOST}/$1";
} else {
$param = 'www.';
htaccess += "\n\n#Redirect to non www version"+
"\nRewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]" +
"\nRewriteRule ^(.*)$ http"+paramHttps+"://%1/$1 [R=301,L]";
}
//Config
if ($('#ht404Redirect').is(":checked"))
{
htaccess += "\n\n#Prevent 404 en non-existing folders"+
"\nOptions -MultiViews";
}
var htDefaultPage = $('#htDefaultPage').val();
if(htDefaultPage!=''){
htaccess += "\n\n#Default page"+
"\nDirectoryIndex "+htDefaultPage;
}
var htAdminEmail = $('#htAdminEmail').val();
if(htAdminEmail!=''){
htaccess += "\n\n#Default contact email"+
"\nSetEnv SERVER_ADMIN "+htAdminEmail;
}
var htForceDownload = $('#htForceDownload').val();
if(htForceDownload!=''){
htaccess += "\n\n#Force download"+
"\nAddType application/octet-stream "+htForceDownload;
}
var htWebCharset = $('#htWebCharset').val();
if(htWebCharset!=''){
htaccess += "\n\n#Default charset"+
"\nAddDefaultCharset "+htWebCharset;
}
var htFileSize = $('#htFileSize').val();
if(htFileSize!=''){
htaccess += "\n\n#Limit upload file size"+
"\nLimitRequestBody "+htFileSize;
}
//Performance
if ($('#htGzip').is(":checked")) {
htaccess += "\n\n#Gzip compression"+
"\n<IfModule mod_gzip.c>"+
"\n mod_gzip_on Yes"+
"\n mod_gzip_dechunk Yes"+
"\n mod_gzip_item_include file .(html?|txt|css|js|php|pl)$"+
"\n mod_gzip_item_include handler ^cgi-script$"+
"\n mod_gzip_item_include mime ^text/.*"+
"\n mod_gzip_item_include mime ^application/x-javascript.*"+
"\n mod_gzip_item_exclude mime ^image/.*"+
"\n mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*"+
"\n</IfModule>";
}
if ($('#htKeepAlive').is(":checked")) {
htaccess += "\n\n#Enable Keep-Alive Headers"+
"\n<IfModule mod_headers.c>"+
"\n Header set Connection Keep-Alive"+
"\n</IfModule>";
}
var htExpiresHeaders = $('#htExpiresHeaders').val();
var htExpiresHeadersFormat = $('#htExpiresHeadersFormat').val();
if(htExpiresHeaders!=''){
htaccess += "\n\n#Set Expires Headers"+
'\n<FilesMatch "\.('+htExpiresHeadersFormat+')$">'+
"\n ExpiresDefault A"+htExpiresHeaders+
"\n</FilesMatch>";
}
//Error
var htCustomError404 = $('#htCustomError404').val();
if(htCustomError404!=''){
htaccess += "\n\n#Default 404 error"+
"\ErrorDocument 404 "+htCustomError404;
}
var htCustomError500 = $('#htCustomError500').val();
if(htCustomError500!=''){
htaccess += "\n\n#Default 500 error"+
"\nErrorDocument 500 "+htCustomError404;
}
//Security
if ($('#htDirectory').is(":checked")) {
htaccess += "\n\n#Prevent directory navigation"+
"\nOptions All -Indexes";
}
if ($('#htDisableCgi').is(":checked")) {
htaccess += "\n\n#Disable CGI"+
"\nOptions -ExecCGI";
}
if ($('#htDisableTech').is(":checked")) {
htaccess += "\n\n#Hide PoweredBy"+
"\nHeader unset X-Powered-By";
}
if ($('#htDisableFrame').is(":checked")) {
htaccess += "\n\n#Do not allow pages to be framed"+
"\nHeader set X-Frame-Options SAMEORIGIN";
}
if ($('#htDisableSign').is(":checked")) {
htaccess += "\n\n#Disable server sign"+
"\nServerSignature Off";
}
var htDisallowScript = $('#htDisallowScript').val();
if(htDisallowScript!=''){
htaccess += "\n\n#Disallow scripts execution"+
"\nAddHandler " +htDisallowScript;
}
var htDenyRequests = $('#htDenyRequests').val();
if(htDenyRequests!=''){
htaccess += "\n\n#Deny request method"+
"\nRewriteCond %{REQUEST_METHOD} !^("+htDenyRequests.toUpperCase()+")"+
"\nRewriteRule .? - [F]";
}
var htHotlinking = $('#htHotlinking').val();
if(htHotlinking!=''){
htaccess += "\n\n#Prevent hotlinking"+
"\nRewriteCond %{HTTP_REFERER} !^$"+
"\nRewriteCond %{HTTP_REFERER} !^http://(www\.)?"+domainReg+"/.*$ [NC]"+
"\nRewriteRule \.(gif|jpg|swf|flv|png)$ "+htHotlinking+" [R=302,L]";
}
if ($('#htSpamBots').is(":checked")) {
rewrite= true;
htaccessSpam = "\n\n #Block Spam Bots"+
"\n RewriteCond %{HTTP_USER_AGENT} ^(aesop_com_spiderman|alexibot|backweb|bandit|batchftp|bigfoot) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(black.?hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(cosmos|crescent|curl|custo|da|diibot|disco|dittospyder|dragonfly) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^(joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^web(zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|reaper|sauger|site.?quester|whack) [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^.*(craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|collector|grabber|webpictures).*$ [NC]" +
"\n RewriteRule . - [F,L]";
}
if ($('#htIllegal').is(":checked")) {
rewrite= true;
htaccessIllegal = "\n\n #Block illegal or unsafe access"+
"\n RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]" +
"\n RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* [NC,OR]" +
"\n RewriteCond %{HTTP_COOKIE} ^.*(<|>|'|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]" +
"\n RewriteCond %{HTTP_USER_AGENT} ^.*(<|>|'|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]" +
"\n RewriteCond %{QUERY_STRING} ^.*(localhost|loopback|127\.0\.0\.1).* [NC,OR]" +
"\n RewriteCond %{QUERY_STRING} ^.*(<|>|'|'|%0A|%0D|%27|%3C|%3E|%00).* [NC]" +
"\n RewriteRule (.*) - [F,L]";
}
if (rewrite == true){
htaccess += "\n\n#Mod Rewrite"+
"\n<IfModule mod_rewrite.c>"+
"\n RewriteEngine On"+
"\n Options +FollowSymlinks"+
"\n RewriteBase /"+
htaccessSpam+
htaccessIllegal+
"\n</IfModule>";
}
$('#htaccessFinal').val(htaccess);
}
);
</script>
</div>
</body>
</html>