Creating friendly URLs with htaccess
The mod
The purpose of this modification is to get rid of the normal URLs IP.Board uses and replace them by new, so-called 'friendly', URLs that both look better and are easier to crawl for search engines.
No source modifications are necessary!
Problems
While this way of using friendly URLs is probably one of, if not the easiest, I would also like to point out two disadvantages:
Links are not replaced
Since this mod works entirely without modifying links, the links sent to the users will still point to the old URLs. As soon as they click on the link, the new URL will be displayed in the address bar, though.
Additional server load
If you are using this mod, every time one of your forums is viewed, an additional HTTP request has to be made. The difference shouldn't really be noticable for your users, but you should be aware that it might cause problems in some cases.
Show me the code already!
############ hbtronix.de/IPB
############ friendly urls with htaccess
########################################
#### Set up rewrite engine
# You may have to enter the path to your IPB here
RewriteEngine on
RewriteBase /
#### Redirect old URLs to new
# This code is there to replace the ?showforum=1 style URLs used throughout IPB by our new URLs.
# nk_auto_furl is used to indicate whether the URL has been redirected already,
# in which case we would start an infinite loop if we redirected again
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} !nk_auto_furl [NC]
RewriteCond %{QUERY_STRING} showforum=([^&]+)(&(.+)$)? [NC]
RewriteRule ^index\.php? forum_%1.html?%3 [R=301,L]
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} !nk_auto_furl [NC]
RewriteCond %{QUERY_STRING} showtopic=([^&]+)(&(.+))?$ [NC]
RewriteRule ^index\.php? thread_%1.html?%3 [R=301,L]
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} !nk_auto_furl [NC]
RewriteCond %{QUERY_STRING} showuser=([^&]+)(&(.+)$)? [NC]
RewriteRule ^index\.php? user_%1.html?%3 [R=301,L]
#### Translate new URLs to old
# Here the new URLs are translated back to the style IPB can understand
RewriteRule ^forum_([^.]+)\.html index.php?nk_auto_furl&showforum=$1 [L,QSA]
RewriteRule ^thread_([^.]+)\.html index.php?nk_auto_furl&showtopic=$1 [L,QSA]
RewriteRule ^user_([^.]+)\.html index.php?nk_auto_furl&showuser=$1 [L,QSA]
Improvements
I haven't been working with mod_rewrite for long, so this code probably isn't perfect. If you find a better way to do things, please let me know!
Credit
If you liked my modifications, please link back to this site (http://hbtronix.de/IPB/)!