MyBB Community Forums

Full Version: .htaccess mode_rewrite conflict with Wordpress?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there!

I am having an issue with my .htaccess and have searched for a solution for the problem without success. I only started to get involved with MyBB recently and I am not a code expert. First, let me explain my setup.

I have a wordpress blog in the root directory www.domain.com . Other than that, I have another wordpress blog under www.domain.com/de
MyBB is installted under www.domain.com/forum . My host is 1and1.com Linux and mod_rewrite is supported.

Since I wanted to enable SEO friendly titles for the MyBB forum, I followed the Wiki guide http://wiki.mybboard.net/index.php/SEF_URLS. After renaming the htaccess.txt file to .htaccess and turning on the "Enable search engine friendly URLs?" in Server and Optimization Options, I get a 404 server
error.

Now I was wondering whether that had anything to do with the fact, that I already have a .htaccess file in my root directory in addition to the .htaccess file in the forum directory.

the .htaccess in my root directory looks like this:

Quote:# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Options All -Indexes

AddType x-mapp-php5 .php

AddHandler x-mapp-php5 .php

# END WordPress

the .htaccess file in my forum directory looks like this:

Quote: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]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]

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

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

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

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

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

RewriteRule ^event-([0-9]+)\.html$ 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/x-javascript text/css text/html text/xml
</IfModule>

Once this issue is fixed I want to install the SEO Google Plugin for MyBB.

Any help is greatly appreciated.

Thanks in advance!
I'm pretty sure that a .htaccess file wil affect all child directories, but if there's another .htaccess in a child folder that'll take precedence; saying that it might not like the RewriteBase in the first one... try adding this to the forum one:

RewriteBase /forum/
(2010-04-23, 07:38 PM)MattRogowski Wrote: [ -> ]I'm pretty sure that a .htaccess file wil affect all child directories, but if there's another .htaccess in a child folder that'll take precedence; saying that it might not like the RewriteBase in the first one... try adding this to the forum one:

RewriteBase /forum/

Thanks Matt, it seems to have worked! Thanks so much.

The titles went from www.domain.com/forum/showthread.php?tid=10&pid=11#pid11

to www.domain.com/forum/thread-10-post-11.html#pid11. Now I can take a look at the seo plugin.
I'd put it directly after RewriteEngine on
I put it at the very beginning and it worked, thanks again!