1

.htaccessファイルを使用して、一連の古いブログ記事の URL をリダイレクトしようとしています。

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

ただし、これは実際には機能しません。私の CMS は少し混乱しているようで、すべての URL にindex.php追加し続けるからです。?symphony-page=

責任があるのはおそらくこの部分です:

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

誰でも助けることができますか?

4

2 に答える 2

1

以下を試してください(説明のためにコメントが含まれています):

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/$1 [L,R=301]

# Frontend Rewrites - for the CMS
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*\/?)$ index.php?symphony-page=$1&%{QUERY_STRING} [L]
于 2016-01-17T06:07:18.727 に答える
1

これを試して:

#-- 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=$1&%{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で上記をテストしましたが、問題なく動作するようです。うまくいけば、あなたにもうまくいくでしょう

スクリーンショット:

ここに画像の説明を入力

于 2016-01-16T16:47:18.503 に答える