commit 4dced7b7c10a7e82acbae3f9b2b1225b40eebcbb
parent d6d79f22ca57b4b247c81c0d898b025ec81bd0f0
Author: flokX <flokX@users.noreply.github.com>
Date: Thu, 26 Sep 2019 15:01:45 +0200
Hardcode .htaccess rewrite rules
Diffstat:
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/.htaccess b/.htaccess
@@ -17,5 +17,11 @@ Header set X-XSS-Protection: "1; mode=block"
# Other
+# Rewrite rule to get the short URLs
+RewriteEngine On
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ redirect.php?short=$1 [L]
+
# Disable directory indexing
Options -Indexes
diff --git a/installer.php b/installer.php
@@ -8,20 +8,6 @@ $config_content = json_decode(file_get_contents($config_path), true);
if ($config_content["installer"]["password"]) {
- // Create root .htaccess with the rewrite rules
- $installation_path = rtrim($_SERVER["REQUEST_URI"], "installer.php");
- $root_htaccess = "
-
-# The entrys below were set by the installer.
-
-# Rewrite rule to get the short URLs
-RewriteEngine On
-RewriteBase $installation_path
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^(.*)$ {$installation_path}redirect.php?short=$1 [L]";
- file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . ".htaccess", $root_htaccess, FILE_APPEND);
-
// Create the .htpasswd for the secure directory. If already a hashed password is in the data.json file, copy it.
$htpasswd_path = implode(DIRECTORY_SEPARATOR, array(__DIR__, "admin", ".htpasswd"));
$admin_password = $config_content["installer"]["password"];