MyBB Tutorials

Remove index.php from URL

Submitted by Mr_Joker, , Thread ID: 4968

Thread Closed
Mr_Joker
YouR JuSt G4Y
Level:
0
Reputation:
3
Posts:
795
Likes:
51
Credits:
493
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!

RE: Remove index.php from URL

Akay
We are!
Level:
0
Reputation:
28
Posts:
946
Likes:
109
Credits:
2.05K
22-06-2015, 12:06 AM
#2
This tutorial exists already.

Users browsing this thread: 1 Guest(s)