MyBB Community Forums

Full Version: URL Rewrite?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can I change community.mybb.com/thread-156213-post-1087037.html
to
community.mybb.com/thread/156213-post-1087037
with a URL rewrite?
You would have to update functions.php
You legend!! Thanks pal! So all I need to do is change {$base_url}thread-{$id}.html to {$base_url}thread/{$id} ?
Yes, you'll also need to update your .htaccess file to match the correct rules.
However, MyBB uses relative URLs everywhere, so running virtual directories will cause a lot of things (avatars, some links, possibly stylesheets/js) so it is generally not recommended to do and will likely take a lot of work to get functioning.
With .htaccess under apache you can do the redirect like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]

As for removing of .html from the url, simply link to the page without .html

<a href="http://www.example.com/page">page</a>