Using regular expression in htaccess for 301 redirects

前端 未结 1 451
旧时难觅i
旧时难觅i 2020-12-16 02:10

I have a Wordpress blog where I am redirecting blog posts from my old blog to my new blog in the format below:

The old blog is call

相关标签:
1条回答
  • 2020-12-16 02:51

    Using mod_alias:

    RedirectMatch 301 ^/news/(.+?)(-[0-9]+)?$ /blog/$1
    

    or using mod_rewrite:

    RewriteEngine On
    RewriteRule ^news/(.+?)(-[0-9]+)?$ /blog/$1 [L,R=301]
    
    0 讨论(0)
提交回复
热议问题