MyBB Community Forums

Full Version: MOD_REWRITE (index.php) and ADMINCP (locked out)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to share an issue and its solution. This has nothing to do with the MyBB code itself. Instead it has to do with using .htaccess files and mod_rewrite.

While recently optimizing (for SEO) the .htaccess file on the root of my domain (which is where my forum is: / )... I added some code to accomplish the following:

Redirect all requests for:
- index.htm
- index.html
- index.php

To:
- / (root)

It worked well, but the way I went about it, also locked me out of the AdminCP, because it was not only rewriting ROOT/index.php to ROOT, it was also rewriting ROOT/ADMIN/index.php to ROOT/ADMIN (which would not allow me access to the administrator control panel.) Obviously a problem!

Now, there are a million and one ways to add code to your .htaccess file, but if you utilize a particular method and find that this issue arises...

FEAR NOT!

Simply create another .htaccess file with the following:

RewriteEngine Off

(and save it to your /admin/ directory) - this will prevent any rewriting from occuring in that crucial location.

* Thought I would share my experience on this because I know how frustrating it can be *