5ch info:Redirect old URL
ナビゲーションに移動
検索に移動
Since there are many links to old URL, it is good to redirect to new URL.
- Old URL
- http://info.2ch.net/wiki/pukiwiki.php?EUC-JP encoded title
- http://info.2ch.net/wiki/pukiwiki.php?page=EUC-JP encoded title
- http://info.2ch.net/wiki/index.php?EUC-JP encoded title
- http://info.2ch.net/wiki/index.php?page=EUC-JP encoded title
- http://info.2ch.net/wiki/?EUC-JP encoded title
- http://info.2ch.net/wiki/?page=EUC-JP encoded title
- New URL
- http://info.2ch.net/index.php/UTF-8 encoded title
/wiki/index.php
<?php ## Setting $NewUri = 'http://info.2ch.net/index.php/'; $NewTopPage = '%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8'; # Main page ## Get title # ?page=title if ( $Title = $_REQUEST['page'] ) { # ?title # ?command=value is excepted } else if ( $_SERVER{'QUERY_STRING'} && strpos($_SERVER{'QUERY_STRING'}, '=' ) === false ) { $Title = $_SERVER{'QUERY_STRING'}; } ## Replace title switch ( $Title ) { case '%A3%B2%A4%C1%A4%E3%A4%F3%A4%CD%A4%EBWiki' : # Top page case 'RecentChanges' : # Special page case 'RecentDeleted' # Special page case 'Help' : # Special page case 'HowToEdit' # Guide case '%A5%DA%A1%BC%A5%B8%CA%D4%BD%B8%A4%CE%C0%E2%CC%C0%BD%F1' # Same as HowToEdit case '' : $Title = $NewTopPage; break; default : # EUC-JP to UTF-8 if ( strpos($_SERVER{'QUERY_STRING'}, '%' ) !== false ) { $Title = urldecode($Title); $Title = mb_convert_encoding($Title, 'UTF-8', 'EUC-JP'); $Title = str_replace(' ', '_', $Title); $Title = urlencode($Title); } } ## Redirect header('Location: ' . $NewUri . $Title, true, 301); exit; ?>
Set to Apache
RewriteEngine On RewriteBase /wiki RewriteRule pukiwiki.php index.php DirectoryIndex index.php