Remove index.php from URL

by Mr_Joker - 21-06-2015, 11:55 PM
YouR JuSt G4Y
Posts:
879
Joined:
Feb 2015
Likes:
35
Credits:
365
Reputation:
3
2 Years of Service
#1
OP
Posted: 21-06-2015, 11:55 PM
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!
We are!
Posts:
1,044
Joined:
Jan 2015
Likes:
108
Credits:
1,946
Reputation:
25
2 Years of Service
#2
Posted: 22-06-2015, 12:06 AM
This tutorial exists already.
Tropical
22-06-2015, 12:15 AM
The last reply on this thread is older than a month. Please do not unnecessarily bump it.
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)