0

次の URL をリダイレクトしたくありません。

1. 差出人: http://www.example.com/tr/component/content/article?id=11 宛先: http://www.example.com/services/terms/

2. 差出人: http://www.example.com/tr/component/content/article?id=45 宛先: http://www.example.com/services/cars/

次のコードがあります。

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{QUERY_STRING} id=11
RewriteRule (.*) http://www.example.com/services/terms/? [R=301,L]

RewriteCond %{QUERY_STRING} id=45
RewriteRule (.*) http://www.example.com/services/cars/? [R=301,L]

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]
</IfModule>

しかし、上記のコードを使用すると、次のように書くことができます-そして、「用語」ページに行き着きます:

http://example.com?id=11

これは間違っています。何を変更すればよいですか?

4

1 に答える 1

1

他のリダイレクト元がないことを確認してください。

私はあなたをApacheに貼り付けただけ.htaccessで、すべてがあなたが望んでいたように機能します.

編集:あなたのコメントによると、(.*)ルールをリダイレクトを機能させたいURLのベースに置き換えることができます:

RewriteCond %{QUERY_STRING} id=11
RewriteRule /?tr/component/content/article(.*) http://www.example.com/services/terms/? [R=301,L]

RewriteCond %{QUERY_STRING} id=45
RewriteRule /?tr/component/content/article(.*) http://www.example.com/services/cars/? [R=301,L]
于 2013-07-05T06:45:30.123 に答える