Apache Rewrite Rules
Posted
by
Philip
on Server Fault
See other posts from Server Fault
or by Philip
Published on 2014-08-21T20:31:42Z
Indexed on
2014/08/21
22:21 UTC
Read the original article
Hit count: 149
mod-rewrite
|apache-2.4
I have moved my website from a Wiki to Wordpress and in the process, realised that I have broken links to some popular pages on my website. Is it possible to fix this with a rewrite rule?
I need the rule to redirect anything beginning with "^/wiki/(.+)$" to "/$1" but also replacing the "_" character used in MediaWiki slugs to "-" used in Wordpress slugs.
For example:
http://example.com/wiki/An_Example_Page
should be pointed to:
http://example.com/an-example-page
Is it possible to write such a rewrite rule?
Edit: It appears that Wordpress doesn't even care if the "/wiki/" part is removed - provided the slug matches, and that seems to be case-insensitive too. So all I need to do is change the "_" characters to "-" in the slugs.
© Server Fault or respective owner