Fix for #803 by @mp035

This commit is contained in:
billz 2021-03-02 14:37:50 +00:00
parent d6570cbc41
commit 33ac6d26cf
2 changed files with 23 additions and 7 deletions

View File

@ -2,8 +2,8 @@ server.modules += (
"mod_rewrite",
)
$HTTP["url"] =~ "^/(?!(dist|app|ajax|config)).*" {
url.rewrite-once = (
"^/[^\?]*(\?.*)?" => "/index.php$1"
)
$HTTP["url"] =~ "^/REPLACE_ME/(?!(dist|app|ajax|config)).*" {
url.rewrite-once = ( "^/REPLACE_ME/(.*?)(\?.+)?$"=>"/REPLACE_ME/index.php/$1?$2" )
server.error-handler-404 = "/REPLACE_ME/index.php"
}

View File

@ -208,14 +208,30 @@ function _install_lighttpd_configs() {
# Copy config files
echo "Copying 50-raspap-router.conf to /etc/lighttpd/conf-available"
sudo cp "$webroot_dir/config/50-raspap-router.conf" "/etc/lighttpd/conf-available" || _install_status 1 "Unable to copy lighttpd config file."
CONFSRC="$webroot_dir/config/50-raspap-router.conf"
LTROOT=$(grep "server.document-root" /etc/lighttpd/lighttpd.conf | awk -F '=' '{print $2}' | tr -d " \"")
# compare values and get difference
HTROOT=${webroot_dir/$LTROOT}
# remove trailing slash if present
HTROOT=$(echo "$HTROOT" | sed -e 's/\/$//')
# substitute values
awk "{gsub(\"/REPLACE_ME\",\"$HTROOT\")}1" $CONFSRC > /tmp/50-raspap-router.conf
# copy into place
sudo cp /tmp/50-raspap-router.conf /etc/lighttpd/conf-available/ || _install_status 1 "Unable to copy lighttpd config file into place."
# link into conf-enabled
echo "Creating link to /etc/lighttpd/conf-enabled"|| _install_status 1 "Unable to copy lighttpd config file."
sudo ln -s "/etc/lighttpd/conf-available/50-raspap-router.conf" "/etc/lighttpd/conf-enabled/50-raspap-router.conf" || _install_status 1 "Unable to symlink lighttpd config file."
echo "Creating link to /etc/lighttpd/conf-enabled"
sudo ln -s "/etc/lighttpd/conf-available/50-raspap-router.conf" "/etc/lighttpd/conf-enabled/50-raspap-router.conf" || _install_status 1 "Unable to symlink lighttpd config file (this is normal if the link already exists)."
sudo systemctl restart lighttpd.service || _install_status 1 "Unable to restart lighttpd"
_install_status 0
}
# Prompt to install ad blocking
function _prompt_install_adblock() {
_install_log "Configure ad blocking (Beta)"