MyBB Community Forums

Full Version: Your own short URLs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Loop Redirect...
................... GOOD REDIRECT ......................
(2011-01-03, 04:11 PM)querschlaeger Wrote: [ -> ]Hi!

If you are using Apache you can create your own short URLs for MyBB (nginx users look here: http://community.mybb.com/thread-85532-p...#pid655723). Just add the following line to your MyBB .htaccess file:

RedirectMatch permanent ^/p([0-9]+)$ http://www.example.com/showthread.php?pid=$1#pid$1
RedirectMatch permanent ^/t([0-9]+)$ http://www.example.com/showthread.php?tid=$1
RedirectMatch permanent ^/f([0-9]+)$ http://www.example.com/forumdisplay.php?fid=$1

It's a very simple redirection but useful on Twitter or Facebook. Just use p(ost), t(hread) or f(orum) and the ID you want to redirect.

Live demo:

http://phurl.de/p7832 -> redirects to a post
http://phurl.de/t1294 -> redirects to a thread
http://phurl.de/f31 -> redirects to a forum
Of course, this also works with user URLs, event URLs and calender URLs:

RedirectMatch permanent ^/u([0-9]+)$ http://www.example.com/member.php?action=profile\&uid=$1
RedirectMatch permanent ^/e([0-9]+)$ http://www.example.com/calendar.php?action=event\&eid=$1
RedirectMatch permanent ^/c([0-9]+)$ http://www.example.com/calendar.php?calendar=$1

Please note the backslash before ampersands.

Hi !

Tried putting the code above in .htaccess file...

does not work ..:-((

I am using the " Google SEO" plugin with e SEO Friendly URLs enabeled....

Anyway to make this work with the above plugin since would really like shorter URLs for FB, Twitter etc....

All help appreciated. Many thanks !
Pages: 1 2 3