CMS を変更したため、古い URL の一部をリダイレクトする必要があります。
私がやりたいことは次のとおりです。
- 「ブログ/アーカイブ」を削除
- アンダースコアをダッシュに置き換えます
- 「.html」を末尾のスラッシュに置き換えます
古いリンク:
http://example.com/blog/archives/the_post_title.html
新しいリンク
http://example.com/the-post-title/
私は書きましたが、ある時点では機能していましたが、現在 500 エラーが発生しています。
RewriteRule ^([^_]*)_([^_]*_.*) $1-$2 [N] #Replace "_" with "-" loop until one left
RewriteRule ^([^_]*)_([^_]*)$ /$1-$2 #Replace the last underscore
RewriteRule ^(.*?).html$ /$1/ [L,R=301] #Strip the ".html" and use the filename as the url, note this as "permanently moved" (301)
サーバーエラーが発生する理由は何ですか?