I have a mediawiki site and I try to remove index.php
from URL
.
So, I followed the doc and some Stack Overflow questions, and I ended up with:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
But when I try mysite.com/some_page
, I am redirected to mysite.com/index.phhp/my_home_page
instead of mysite.com/index.phhp/some_page
. Where am I wrong ?
You replace:
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
with:
RewriteRule ^ index.php [L]
Your code is completely handles missing files or directories , so if user write wrong url the code will run .
Put the following code at root .htaccess
file so no index.php will be shown at root directory as well as sub directories :
RewriteEngine On
RewriteRule ^(.*)index\.php /$1 [R=302,L,NE]