Jump to content

Hide index php: Difference between revisions

From Wiki
No edit summary
No edit summary
Line 1: Line 1:
<div style="max-width:70em; margin:auto;">'''STEP 1:''' Add the following code to .htaccess file:
'''STEP 1:''' Add the following code to .htaccess file:
  RewriteEngine On
  RewriteEngine On
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
Line 22: Line 22:


[[Category:Tutorial]]
[[Category:Tutorial]]
</div>

Revision as of 22:08, 6 November 2021

STEP 1: Add the following code to .htaccess file:

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/MW-DIRECTORY/index.php [L]

Replace MW-DIRECTORY with the name of directory wherein you have installed MediaWiki (i.e. the directory which contains MediWiki files and folders like extensions, cache, maintenance, skins etc.)

Where to put .htaccess? The .htaccess file should be placed in the MediaWiki installation directory.

STEP 2: Now add the following code in LocalSettings.php

$wgScriptPath       = “/MW-DIRECTORY“;
$wgScriptExtension  = “.php”;
$wgArticlePath = “{$wgScriptPath}/$1”;
$wgUsePathInfo = true;

Replace MW-DIRECTORY with the MediaWiki installation directory. Your LocalSettings.php file might already contain the first two lines of the code given above. If these lines are already present –just add the second and third line right below the existing lines.

Referensi