Skip to content

Commit 0b16909

Browse files
authored
Merge pull request #120 from yigitkeremoktay/patch-3
Fix a major issue
2 parents 9f2e2db + 7fceaf7 commit 0b16909

File tree

1 file changed

+9
-139
lines changed

1 file changed

+9
-139
lines changed

create-server-config.php

Lines changed: 9 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,23 @@
1-
<?php
1+
<?php
22
/********************************************************************/
3-
// create-htaccess.php
3+
// create-server-config.php
44
// Created by Yigit Kerem Oktay
5-
// This file generates a .htaccess file that contains all necessary
5+
// This file generates a .htaccess file that contains all necessary
66
// code for it.
77
// This is needed because some hosts do not either unzip hidden files
88
// or neither GitHub puts that file inside the zips.
99
/********************************************************************/
1010
if(stripos($_SERVER['SERVER_SOFTWARE'],'apache')!== false){
1111
$f = fopen(".htaccess", "a+");
12-
fwrite($f, "ErrorDocument 404 /404.php
13-
14-
<IfModule mod_headers.c>
15-
Header set X-UA-Compatible "IE=edge"
16-
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|woff2?|xloc|xml|xpi)$">
17-
Header unset X-UA-Compatible
18-
</FilesMatch>
19-
</IfModule>
20-
21-
<IfModule mod_rewrite.c>
22-
#DELETE THIS IF YOU DON'T HAVE HTTPS!
23-
RewriteEngine On
24-
RewriteCond %{HTTP:X-Forwarded-Proto} !https
25-
RewriteCond %{HTTPS} off
26-
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
27-
</IfModule>
28-
29-
30-
<IfModule mod_headers.c>
31-
Header set X-Content-Type-Options "nosniff"
32-
</IfModule>
33-
34-
<IfModule mod_deflate.c>
35-
36-
<IfModule mod_setenvif.c>
37-
<IfModule mod_headers.c>
38-
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
39-
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
40-
</IfModule>
41-
</IfModule>
42-
43-
<IfModule mod_filter.c>
44-
AddOutputFilterByType DEFLATE "application/atom+xml" \
45-
"application/javascript" \
46-
"application/json" \
47-
"application/ld+json" \
48-
"application/manifest+json" \
49-
"application/rdf+xml" \
50-
"application/rss+xml" \
51-
"application/schema+json" \
52-
"application/vnd.geo+json" \
53-
"application/vnd.ms-fontobject" \
54-
"application/x-font-ttf" \
55-
"application/x-javascript" \
56-
"application/x-web-app-manifest+json" \
57-
"application/xhtml+xml" \
58-
"application/xml" \
59-
"font/eot" \
60-
"font/opentype" \
61-
"image/bmp" \
62-
"image/svg+xml" \
63-
"image/vnd.microsoft.icon" \
64-
"image/x-icon" \
65-
"text/cache-manifest" \
66-
"text/css" \
67-
"text/html" \
68-
"text/javascript" \
69-
"text/plain" \
70-
"text/vcard" \
71-
"text/vnd.rim.location.xloc" \
72-
"text/vtt" \
73-
"text/x-component" \
74-
"text/x-cross-domain-policy" \
75-
"text/xml"
76-
</IfModule>
77-
78-
<IfModule mod_mime.c>
79-
AddEncoding gzip svgz
80-
</IfModule>
81-
82-
<IfModule mod_headers.c>
83-
Header unset ETag
84-
</IfModule>
85-
86-
FileETag None
87-
88-
<IfModule mod_expires.c>
89-
ExpiresActive on
90-
ExpiresDefault "access plus 1 month"
91-
ExpiresByType text/css "access plus 1 year"
92-
ExpiresByType application/atom+xml "access plus 1 hour"
93-
ExpiresByType application/rdf+xml "access plus 1 hour"
94-
ExpiresByType application/rss+xml "access plus 1 hour"
95-
ExpiresByType application/json "access plus 0 seconds"
96-
ExpiresByType application/ld+json "access plus 0 seconds"
97-
ExpiresByType application/schema+json "access plus 0 seconds"
98-
ExpiresByType application/vnd.geo+json "access plus 0 seconds"
99-
ExpiresByType application/xml "access plus 0 seconds"
100-
ExpiresByType text/xml "access plus 0 seconds"
101-
ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
102-
ExpiresByType image/x-icon "access plus 1 week"
103-
ExpiresByType text/html "access plus 0 seconds"
104-
ExpiresByType application/javascript "access plus 1 year"
105-
ExpiresByType application/x-javascript "access plus 1 year"
106-
ExpiresByType text/javascript "access plus 1 year"
107-
ExpiresByType application/manifest+json "access plus 1 year"
108-
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
109-
ExpiresByType text/cache-manifest "access plus 0 seconds"
110-
ExpiresByType audio/ogg "access plus 1 month"
111-
ExpiresByType image/bmp "access plus 1 month"
112-
ExpiresByType image/gif "access plus 1 month"
113-
ExpiresByType image/jpeg "access plus 1 month"
114-
ExpiresByType image/png "access plus 1 month"
115-
ExpiresByType image/svg+xml "access plus 1 month"
116-
ExpiresByType video/mp4 "access plus 1 month"
117-
ExpiresByType video/ogg "access plus 1 month"
118-
ExpiresByType video/webm "access plus 1 month"
119-
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
120-
ExpiresByType font/eot "access plus 1 month"
121-
ExpiresByType font/opentype "access plus 1 month"
122-
ExpiresByType application/x-font-ttf "access plus 1 month"
123-
ExpiresByType application/font-woff "access plus 1 month"
124-
ExpiresByType application/x-font-woff "access plus 1 month"
125-
ExpiresByType font/woff "access plus 1 month"
126-
ExpiresByType application/font-woff2 "access plus 1 month"
127-
ExpiresByType text/x-cross-domain-policy "access plus 1 week"
128-
</IfModule>");
12+
$f2 = fopen("ApacheHtaccess","r");
13+
fwrite($f, fread($f2, filesize("ApacheHtaccess")));
12914
fclose($f);
15+
fclose($f2);
13016
} else {
13117
$f = fopen("web.config", "a+");
132-
fwrite($f, "<?xml version="1.0" encoding="UTF-8"?>
133-
<configuration>
134-
<system.webServer>
135-
<rewrite>
136-
<rules>
137-
<rule name="Imported Rule 1" stopProcessing="true">
138-
<match url="^(.*)$" ignoreCase="false" />
139-
<conditions>
140-
<add input="{HTTPS}" pattern="off" ignoreCase="false" />
141-
</conditions>
142-
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}{URL}" />
143-
</rule>
144-
</rules>
145-
</rewrite>
146-
<staticContent>
147-
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
148-
</staticContent>
149-
</system.webServer>
150-
</configuration>");
18+
$f2 = fopen("IISWebConfig","r");
19+
fwrite($f, fread($f2, filesize("IISWebConfig")));
15120
fclose($f);
21+
fclose($f2);
15222
}
15323
?>

0 commit comments

Comments
 (0)