This is an extension for the phpBB forums software. You need an instalation of phpBB 3.1.x to use this extension.
##DESCRIPTION Changes the URLs of forums and topics too more SEO friendly URLs with the title of the forums and topics in it. This extension is held as simple as possible, it contains no ACP, you can just install it and use the SEO friendly URLs.
/viewforum.php?f=1 becomes /forum-title-f1/
/viewtopic.php?f=1&t=2 becomes /forum-title-f1/topic-title-t2.html
##INSTALLATION To install this extension download it from here and upload the files in your forum under /ext/tas2580/seourls. After that go to the Admin panel of your forum and navigate in to Customise -> Extension Management -> Extensions. Search this extension in the list of extensions and click on Enable.
###URL Rewriting 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]*)/(.*)-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]*)/(.*)-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}
}
##SUPPORT You can get support for this extension on phpbb.com or in german on phpbb.de. For more informations look at my Website.
##LICENSE GNU General Public License v2
##Automated Testing We use automated unit tests to prevent regressions. Check out our travis build below: