0

I've been staring at this for far too long. To cope with a Wordpress URL structure change, I need a URL rewrite to cope with old links that are floating around the net. The rule I've created is

RewriteRule [0-9]+/[0-9]+/[0-9]+/(.+)$ /$1 [R=301,L]

To match posts with URLs like

/2013/02/05/Some-wonderful-article 

supposedly redirecting to

/Some-wonderful-article

Apache seems to be ignoring this, though, and happily sticks with the original URL. Can anyone see why? Am I forgetting some quirk of Apache's implementation of regex? I've already wasted some time playing with \d instead of [0-9] ...

4

1 に答える 1

0

このルールを試してください:

RewriteEngine on
RewriteBase /
RewriteRule ^/?[0-9]+/[0-9]+/[0-9]+/(.+)$ /$1 [R=301,L]

リライトエンジンをアクティブにするコマンドと、RewriteRulesのベースを定義する行を追加しました。

于 2013-02-05T17:36:42.900 に答える