mirror of
				https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
				synced 2025-11-03 12:10:20 -05:00 
			
		
		
		
	Create create-htaccess.php (#108)
* Create create-htaccess.php This file generates a .htaccess file that contains all necessary code for it. This is needed because some hosts do not either unzip hidden files or neither GitHub puts that file inside the zips. * Delete .htaccess * Add required code for creating htaccess * Add support for both iis and apache * Delete web.config * Rename create-htaccess.php to create-server-config.php * Rename file links for create-server-config.php * Last nitpick :)
This commit is contained in:
		
							parent
							
								
									7362c857b0
								
							
						
					
					
						commit
						484bbd60d0
					
				@ -1,4 +1,15 @@
 | 
			
		||||
ErrorDocument 404 /404.php
 | 
			
		||||
<?php 
 | 
			
		||||
/********************************************************************/
 | 
			
		||||
//                       create-htaccess.php
 | 
			
		||||
//                  Created by Yigit Kerem Oktay
 | 
			
		||||
// This file generates a .htaccess file that contains all necessary 
 | 
			
		||||
// code for it.
 | 
			
		||||
// This is needed because some hosts do not either unzip hidden files
 | 
			
		||||
// or neither GitHub puts that file inside the zips.
 | 
			
		||||
/********************************************************************/
 | 
			
		||||
if(stripos($_SERVER['SERVER_SOFTWARE'],'apache')!== false){
 | 
			
		||||
$f = fopen(".htaccess", "a+");
 | 
			
		||||
fwrite($f, "ErrorDocument 404 /404.php
 | 
			
		||||
 | 
			
		||||
<IfModule mod_headers.c>
 | 
			
		||||
    Header set X-UA-Compatible "IE=edge"
 | 
			
		||||
@ -114,4 +125,29 @@ FileETag None
 | 
			
		||||
    ExpiresByType font/woff                             "access plus 1 month"
 | 
			
		||||
    ExpiresByType application/font-woff2                "access plus 1 month"
 | 
			
		||||
    ExpiresByType text/x-cross-domain-policy            "access plus 1 week"
 | 
			
		||||
</IfModule>
 | 
			
		||||
</IfModule>");
 | 
			
		||||
fclose($f);
 | 
			
		||||
} else {
 | 
			
		||||
$f = fopen("web.config", "a+");
 | 
			
		||||
fwrite($f, "<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<configuration>
 | 
			
		||||
	<system.webServer>
 | 
			
		||||
		<rewrite>
 | 
			
		||||
			<rules>
 | 
			
		||||
				<rule name="Imported Rule 1" stopProcessing="true">
 | 
			
		||||
					<match url="^(.*)$" ignoreCase="false" />
 | 
			
		||||
					<conditions>
 | 
			
		||||
						<add input="{HTTPS}" pattern="off" ignoreCase="false" />
 | 
			
		||||
					</conditions>
 | 
			
		||||
					<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}{URL}" />
 | 
			
		||||
				</rule>
 | 
			
		||||
			</rules>
 | 
			
		||||
		</rewrite>
 | 
			
		||||
		<staticContent>
 | 
			
		||||
			<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
 | 
			
		||||
		</staticContent>
 | 
			
		||||
	</system.webServer>
 | 
			
		||||
</configuration>");
 | 
			
		||||
fclose($f);
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
@ -132,7 +132,8 @@ if(isset($_POST['server']) && empty($message))
 | 
			
		||||
		$config = str_replace("##policy_url##", $policy_url_conf, $config);
 | 
			
		||||
		file_put_contents("config.php", $config);
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		include_once "create-server-config.php";
 | 
			
		||||
		unlink("create-server-config.php");
 | 
			
		||||
		unlink("config.php.template");
 | 
			
		||||
		unlink("install.sql");
 | 
			
		||||
		unlink(__FILE__);
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										19
									
								
								web.config
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								web.config
									
									
									
									
									
								
							@ -1,19 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<configuration>
 | 
			
		||||
	<system.webServer>
 | 
			
		||||
		<rewrite>
 | 
			
		||||
			<rules>
 | 
			
		||||
				<rule name="Imported Rule 1" stopProcessing="true">
 | 
			
		||||
					<match url="^(.*)$" ignoreCase="false" />
 | 
			
		||||
					<conditions>
 | 
			
		||||
						<add input="{HTTPS}" pattern="off" ignoreCase="false" />
 | 
			
		||||
					</conditions>
 | 
			
		||||
					<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}{URL}" />
 | 
			
		||||
				</rule>
 | 
			
		||||
			</rules>
 | 
			
		||||
		</rewrite>
 | 
			
		||||
		<staticContent>
 | 
			
		||||
			<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
 | 
			
		||||
		</staticContent>
 | 
			
		||||
	</system.webServer>
 | 
			
		||||
</configuration>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user