-
Notifications
You must be signed in to change notification settings - Fork 25
Webserver configuration
Tobi Schäfer edited this page Oct 12, 2018
·
4 revisions
The extension modifies the links that are outputed by the forum. So you need to rewrite the new links to working URLs.
Open your .htacces and find RewriteEngine on
right after this add the following code:
RewriteBase /
RewriteRule ^(.*)-f([0-9]*)/mcp.php(.*) mcp.php?%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html viewtopic.php?f=$2&t=$4&start=$5&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/(.*)-t([0-9]*).html viewtopic.php?f=$2&t=$4&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/index-s([0-9]*).html viewforum.php?f=$2&start=$3&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*)/ viewforum.php?f=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-f([0-9]*) viewforum.php?f=$2&%{QUERY_STRING} [L]
If your forum is under domain.tld/forum you also need to change RewriteBase /
to RewriteBase /forum
Open your /etc/nginx/nginx.conf
and add the following code to your VHost configuration.
location / {
rewrite ^/(.*)-f([0-9]*)/mcp.php(.*) mcp.php?$query_string;
rewrite ^/(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html /viewtopic.php?f=$2&t=$4&start=$5&$query_string last;
rewrite ^/(.*)-f([0-9]*)/(.*)-t([0-9]*).html /viewtopic.php?f=$2&t=$4&$query_string last;
rewrite ^/(.*)-f([0-9]*)/index-s([0-9]*).html /viewforum.php?f=$2&start=$3&$query_string last;
rewrite ^/(.*)-f([0-9]*)/ /viewforum.php?f=$2&$query_string last;
rewrite ^/(.*)-f([0-9]*) /viewforum.php?f=$2&$query_string last;
}
Open your /etc/lighttpd/lighttpd.conf
and add the following code to your VHost configuration.
url.rewrite-once = (
"/(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html(\?(.*))?" => "/viewtopic.php?f=$2&t=$4&start=$5&$7",
"/(.*)-f([0-9]*)/(.*)-t([0-9]*).html(\?(.*))?" => "/viewtopic.php?f=$2&t=$4&$6",
"/(.*)-f([0-9]*)/index-s([0-9]*).html(\?(.*))?" => "/viewforum.php?f=$2&start=$3&$5",
"/(.*)-f([0-9]*)/(\?(.*))?" => "/viewforum.php?f=$2&$4",
)
Open your Caddyfile
and add the following code to your VHost configuration.
rewrite {
regexp /(.*)-f([0-9]*)/(.*)-t([0-9]*)-s([0-9]*).html(\?(.*))?
to /viewtopic.php?f={2}&t={4}&start={5}&{7}
}
rewrite {
regexp /(.*)-f([0-9]*)/(.*)-t([0-9]*).html(\?(.*))?
to /viewtopic.php?f={2}&t={4}&{6}
}
rewrite {
regexp /(.*)-f([0-9]*)/index-s([0-9]*).html(\?(.*))?
to /viewforum.php?f={2}&start=${3}&{5}
}
rewrite {
regexp /(.*)-f([0-9]*)/(\?(.*))?
to /viewforum.php?f={2}&{4}
}