apache - Rewrite old mediawiki URL pattern to short URL format -
we have been running mediawiki installation years now. during upgrade newer version, decided switch short url pattern wikipedia uses. working fine.
so our config file looks
# enable rewrite engine rewriteengine on # short url wiki pages rewritecond %{document_root}%{request_uri} !-f rewritecond %{document_root}%{request_uri} !-d rewriterule ^(.*)$ %{document_root}/index.php [nc]
as specified in documentation mediawiki.
but have old urls floating around other places, support still.
the old url this:
wiki.domain.com/wiki/index.php/articlename
now url looks this:
wiki.domain.com/wiki/articlename
but using old url, gives page not found.
we have tried using online htaccess tester find correct rewriterule. , work there. not when using in on our apache server config.
tried rule, right after rewriteengine on:
rewriterule ^(.*?)index\.php(/|$) /$1 [r=301,nc,ne]
which supposed redirect user new url. still page not found error, , url still looks same. our new rewrite rule wrong, or might there else wrong in apache config. provide config file if need be.
ended rule:
rewriterule ^(.*?)index\.php\/(.*) $1$2 [l,nc,r=301]
select parts before , after index.php , store them using (). using $1 , 2 create new url string. i'm sure there better solutions, works too.
Comments
Post a Comment