mediawiki
MediaWiki is the wiki-engine that runs Wikipedia. In this tutorial, we introduce how to configure search engine friendly URLs in MediaWiki.
MediaWiki是运行Wikipedia的Wiki引擎。 在本教程中 ,我们介绍如何在MediaWiki中配置搜索引擎友好的URL。
搜索引擎友好网址∞ (Search Engine Friendly URLs ∞)
Default MediaWiki URLs look like www.example.com/w/index.php?title=TITLE
which is a little ugly. To make it more search engine friendly, we will change it to SEO-friendly URLs like www.example.com/w/TITLE
.
默认的 MediaWiki URL看起来像www.example.com/w/index.php?title=TITLE
,这有点难看。 为了使其对搜索引擎更加友好,我们将其更改为对SEO友好的URL,例如www.example.com/w/TITLE
。
启用搜索引擎友好的网址∞ (Enabling Search Engine Friendly URLs ∞)
”’Step 1.”’ Change the URL settings by using two configuration variables in LocalSettings.php: $wgScript and $wgArticlePath.
“'第1步。''通过在LocalSettings.php中使用两个配置变量:$ wgScript和$ wgArticlePath来更改URL设置。
Open the LocalSettings.php (located in MediaWiki root folder) and append these lines:
打开LocalSettings.php(位于MediaWiki根文件夹中)并添加以下行:
$wgScript = "/w/";
$wgArticlePath = "$wgScript$1";
The $wgScript variable must contain path to the MediaWiki directory.
$ wgScript变量必须包含MediaWiki目录的路径。
”’Step 2.”’ Create a .htaccess file in the installation folder ( /w/ ) of MediaWiki and put these lines:
“'第2步。''创建一个。 将htaccess文件放到MediaWiki的安装文件夹(/ w /)中,并放置以下几行:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?title=$1 [NC,L,QSA]
Then the MediaWiki’s URLs are more search engine friendly now.
然后,MediaWiki的URL现在对搜索引擎更加友好了。
翻译自: https://www.systutorials.com/search-engine-friendly-url-for-mediawiki/
mediawiki