0

これに関する他のすべての投稿を確認しましたが、機能させることができないようです。Joomlaの設定やアイテムなどを変更できない理由はいくつかありますが、いずれにしても、これらはそれでも機能するはずです。

つまり、Itemid = 30を含むリンクを、指定されたリンクにリダイレクトする必要があります。私は何が間違っているのですか?最初の3つは私が試したもので、最後の行は機能している行です。

RedirectMatch 301 ^Itemid=30$ http://inside.beta.oursite.com/index.php?option=com_cware&view=courses&Itemid=125

redirect 301 index.php?option=com_cware&view=courses&Itemid=30 http://inside.beta.oursite.com/index.php?option=com_cware&view=courses&Itemid=125

RewriteEngine On
RewriteCond %{QUERY_STRING} Itemid=30
RewriteRule ^Itemid=30/$ index.php?option=com_content&view=article&id=106&Itemid=121 [R=301]


# If query string contains "username=admin"
RewriteCond %{QUERY_STRING} username=admin
# Block it without mercy
RewriteRule .* - [F]
4

1 に答える 1

1

Redirectクエリ文字列を除外したURLパスのみを考慮します。クエリ文字列を考慮に入れる場合は、を使用する必要がありますmod_rewrite

同じことが当てはまりますRewriteRule

ホスト名、ポート、またはクエリ文字列と照合する場合は、それぞれ%{HTTP_HOST}、%{SERVER_PORT}、または%{QUERY_STRING}変数でRewriteCondを使用します。

したがって、クエリ文字列を照合してすべてのURLを他のURLにリダイレクトする場合は、RewriteCondをRewriteRuleと組み合わせて使用​​します。

RewriteEngine On
RewriteCond %{QUERY_STRING} Itemid=30
RewriteRule .* index.php?option=com_content&view=article&id=106&Itemid=121 [R=301]

.*これにより、クエリ文字列を含むすべてのURLがにリダイレクトされますItemid=30index.php?option=com_content&...

于 2013-03-04T22:03:30.957 に答える