【发布时间】:2022-01-04 05:15:02
【问题描述】:
我有所有页面的旧 URL 路径
example.com/w/Page_title
现在我改成
example.com/Page_title
问题是: 如何为使用书签返回的用户从旧路径进行 301 重定向?
我的 LocalSettings.php
$wgForceHTTPS = true;
$wgScriptPath = "/wiki";
$wgArticlePath = "/$1";
和 mod_rewrite:
RewriteEngine On
# Short URL for wiki pages
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]
# Redirect Main Page to /
RewriteRule ^/*$ /index.php?title=Main_Page [L,QSA]
RewriteRule .*\.ico$ - [L]
【问题讨论】:
标签: apache url redirect mediawiki