MyBB Tutorials

Remove index.php from URL

Submitted by Mr_Joker, , Thread ID: 4968

Thread Closed
21-06-2015, 11:55 PM
#1
Hi,

this is a very simple way to remove the index.php from your URL. Please note that this only works if you are running an Apache web server and mod_rewrite is enabled!

Just add the following lines to your root .htaccess file (directly after RewriteEngine On):
Code:
RewriteCond %{IS_SUBREQ} false
RewriteRule ^index.php$ http://www.example.org [R=301,L]

Of course you have to replace http://www.example.org wit your own MyBB installation. For example:
Code:
RewriteRule ^index.php$ http://community.mybb.com [R=301,L]
(this will work on this domain)

Code:
RewriteRule ^index.php$ http://www.example.org/board/ [R=301,L]
(if you installed MyBB in a sub folder)

The trick is the IS_SUBREQ: So the redirect will not work in sub directories like /admin or /archive (the index.php have to stay there) and it will no affect POST or GET requests!

Users browsing this thread: