MyBB Community Forums

Full Version: How to change mybb urls
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to change MyBB Urls

i am using mybb search engine friendly urls but i want to change forum-1.html to forum-1.

similarly thread-1.html to thread-1

how to do that

my forum url ( http://leakshunt.com )
You will need to edit two things.

1) You'll need to edit your /inc/init.php file. Find where it says define('FORUM_URL', "forum-{fid}.html");
Remove the .html part. You'll do the same thing with the rest of those define functions. It should be around line 213 to help you out.

2) You will need to edit your .htaccess file. All the rules like this:
RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]

need to have the \.html removed. The dollar sign should be after the parenthesis so it looks like this:
RewriteRule ^forum-([0-9]+)$ forumdisplay.php?fid=$1 [L,QSA]
(2014-10-11, 01:09 PM)dragonexpert Wrote: [ -> ]You will need to edit two things.

1) You'll need to edit your /inc/init.php file.  Find where it says define('FORUM_URL', "forum-{fid}.html");
Remove the .html part.  You'll do the same thing with the rest of those define functions.  It should be around line 213 to help you out.

2) You will need to edit your .htaccess file.  All the rules like this:
RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]

need to have the \.html removed.  The dollar sign should be after the parenthesis so it looks like this:
RewriteRule ^forum-([0-9]+)$ forumdisplay.php?fid=$1 [L,QSA]

i removed .html from

{
	define('FORUM_URL', "forum-{fid}");
	define('FORUM_URL_PAGED', "forum-{fid}-page-{page}");
	define('THREAD_URL', "thread-{tid}");
	define('THREAD_URL_PAGED', "thread-{tid}-page-{page}");
	define('THREAD_URL_ACTION', 'thread-{tid}-{action}');
	define('THREAD_URL_POST', 'thread-{tid}-post-{pid}');
	define('POST_URL', "post-{pid}");
	define('PROFILE_URL', "user-{uid}");
	define('ANNOUNCEMENT_URL', "announcement-{aid}");
	define('CALENDAR_URL', "calendar-{calendar}");
	define('CALENDAR_URL_YEAR', 'calendar-{calendar}-year-{year}');
	define('CALENDAR_URL_MONTH', 'calendar-{calendar}-year-{year}-month-{month}');
	define('CALENDAR_URL_DAY', 'calendar-{calendar}-year-{year}-month-{month}-day-{day}');
	define('CALENDAR_URL_WEEK', 'calendar-{calendar}-week-{week}');
	define('EVENT_URL', "event-{eid}");
}

and changed .htaccess file but when i click forum it goes to 404 error

http://leakshunt.com/forum-37
Can you paste your .htacess file?
Mr Leaks may i know the reason for you to change seo friendly urls to default ones? Aren't SEO friendly urls supposed to perform better in search results?
(2014-10-11, 01:31 PM)Euan T Wrote: [ -> ]Can you paste your .htacess file?

here is my file
Options -MultiViews +FollowSymlinks -Indexes

#
# If mod_security is enabled, attempt to disable it.
# - Note, this will work on the majority of hosts but on
#   MediaTemple, it is known to cause random Internal Server
#   errors. For MediaTemple, please remove the block below
#
<IfModule mod_security.c>
	# Turn off mod_security filtering.
	SecFilterEngine Off

	# The below probably isn't needed, but better safe than sorry.
	SecFilterScanPOST Off
</IfModule>

#
# MyBB "search engine friendly" URL rewrites
# - Note, for these to work with MyBB please make sure you have
#   the setting enabled in the Admin CP and you have this file
#   named .htaccess
#
<IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteRule ^forum-([0-9]+)$ forumdisplay.php?fid=$1 [L,QSA]
	RewriteRule ^forum-([0-9]+)-page-([0-9]+)$ forumdisplay.php?fid=$1&page=$2 [L,QSA]

	RewriteRule ^thread-([0-9]+)$ showthread.php?tid=$1 [L,QSA]
	RewriteRule ^thread-([0-9]+)-page-([0-9]+)$ showthread.php?tid=$1&page=$2 [L,QSA]
	RewriteRule ^thread-([0-9]+)-lastpost$ showthread.php?tid=$1&action=lastpost [L,QSA]
	RewriteRule ^thread-([0-9]+)-nextnewest$ showthread.php?tid=$1&action=nextnewest [L,QSA]
	RewriteRule ^thread-([0-9]+)-nextoldes$ showthread.php?tid=$1&action=nextoldest [L,QSA]
	RewriteRule ^thread-([0-9]+)-newpost$ showthread.php?tid=$1&action=newpost [L,QSA]
	RewriteRule ^thread-([0-9]+)-post-([0-9]+)$ showthread.php?tid=$1&pid=$2 [L,QSA]

	RewriteRule ^post-([0-9]+)$ showthread.php?pid=$1 [L,QSA]

	RewriteRule ^announcement-([0-9]+)$ announcements.php?aid=$1 [L,QSA]

	RewriteRule ^user-([0-9]+)$ member.php?action=profile&uid=$1 [L,QSA]

	RewriteRule ^calendar-([0-9]+)$ calendar.php?calendar=$1 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-year-([0-9]+)$ calendar.php?action=yearview&calendar=$1&year=$2 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]

	RewriteRule ^event-([0-9]+)$ calendar.php?action=event&eid=$1 [L,QSA]

	<IfModule mod_env.c>
		SetEnv SEO_SUPPORT 1
	</IfModule>
</IfModule>

#
# If Apache is compiled with built in mod_deflade/GZIP support
# then GZIP Javascript, CSS, HTML and XML so they're sent to
# the client faster.
#
<IfModule mod_deflate.c>
	AddOutputFilterByType DEFLATE application/javascript text/css text/html text/xml
</IfModule>
Use MyBB Google SEO Plugins. Have a look here :- http://community.mybb.com/thread-159488.html
I don't believe his webhost seems to support mod_rewrite. I even tried modifying his .htaccess file myself and was getting 404s.
Just checked the host. It is godaddy. i think they should support mod_rewrite but may be they don't.