如何重定向博客文章 URL?

How to re-direct blog article URLs?

我正在尝试使用 .htaccess 文件重定向一堆旧博客文章 URL:

RedirectMatch ^/index\.php/global/article/(.*)$ http://www.mywebsite.com/blog/article/

然而,这并没有真正起作用,因为我的 CMS 似乎被 index.php 位弄糊涂了,并不断向所有 URL 添加 ?symphony-page=

可能是这部分负责:

### FRONTEND REWRITE - Will ignore files and folders
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*\/?)$ index.php?symphony-page=&%{QUERY_STRING}    [L]

有人可以帮忙吗?

试试这个:

#-- Input URL >>  http://www.mywebsite.com/index.php/global/article/abc


### FRONTEND REWRITE - Will ignore files and folders
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*\/?)$ index.php?symphony-page=&%{QUERY_STRING}

RewriteCond %{REQUEST_URI} ^/index\.php/global/article/(.*)$
RewriteRule ^.*$ blog/article/%1  [R=301, L]


#--Output URL >>  http://www.mywebsite.com/blog/article/abc

我已经用这个 htaccess.madewithlove 测试了上面的内容,它似乎可以正常工作,希望它也对你有用

截图:

请尝试以下操作(包括评论解释):

RewriteEngine On

# First, redirect the old URIs to the new ones via a 301 redirect.
# This will allow the CMS to take over using the rules that follow.
RewriteRule ^index.php/global/article/(.+)$ /blog/article/ [L,R=301]

# Frontend Rewrites - for the CMS
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*\/?)$ index.php?symphony-page=&%{QUERY_STRING} [L]