I just set up a forum with phpBB 3.2 earlier this week, and I wanted to make the forum and topic URLs user-readable and SEO-friendly. I have read the forum and blog posts about how this doesn't really matter to the search engines anymore, but I figured it'd be a nice to have feature just for readability.
So I decided to make some modifications to the phpBB source files in order to get this to work. Note that this is not in any means the ideal way to do this, especially since if the modified files are affected in a future update, you will have to check and merge, but if you like to live on the edge, keep reading.
Warning/Disclaimer: Proceed with making these changes at your own risk. I am not liable for any damage or harm that may occur to your forum, database, computer or pets from making use of the files provided. Remember to create multiple backups of your files before doing anything.
First, we need to configure the URL rewrite rules.
- memberlist.php becomes /members
- memberlist.php?mode=viewprofile&u=2 becomes /members/u2-admin
- viewforum.php?f=1 becomes /f1-your-first-forum
- viewtopic.php?t=1&f=1 becomes /f1-your-first-forum/t1-my-topic-title
Code: Select all
RewriteRule ^members(|/)$ /memberlist.php [QSA,L]
RewriteRule ^members/u(\d+)([a-zA-Z0-9\-_]+)$ /memberlist.php?mode=viewprofile&u=$1 [QSA,L]
RewriteRule ^f(\d+)([a-zA-Z0-9\-]+)/t(\d+)([a-zA-Z0-9\-]+)(.*)$ /viewtopic.php?f=$1&t=$3 [QSA,L]
RewriteRule ^f(\d+)([a-zA-Z0-9\-]+)(.*)$ /viewforum.php?f=$1 [QSA,L]
Code: Select all
location /members {
rewrite ^/members(|/)$ /memberlist.php last;
rewrite ^/members/u(\d+)([a-zA-Z0-9\-_]+)$ /memberlist.php?mode=viewprofile&u=$1$is_args$args last;
}
location /f {
rewrite ^/f(\d+)([a-zA-Z0-9\-]+)/t(\d+)([a-zA-Z0-9\-]+)(.*)$ /viewtopic.php?f=$1&t=$3$is_args$args last;
rewrite ^/f(\d+)([a-zA-Z0-9\-]+)(.*)$ /viewforum.php?f=$1$is_args$args last;
}
Code: Select all
.htaccess
index.php
memberlist.php
posting.php
search.php
viewforum.php
viewonline.php
viewtopic.php
includes/functions.php
includes/functions_content.php
includes/functions_display.php
includes/functions_posting.php
phpbb/feed/helper.php
You can download the ZIP archive from https://drive.google.com/file/d/0B27L6m ... sp=sharing
Cheers.