0

私はすべての URL を書き直しており、そのうちのいくつかを簡略化しています。

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(([^\.]+))\.pl [NC]
RewriteRule ^(.*)$ http://%1.pl%{REQUEST_URI} [R=301,L]
RewriteRule ^test$ test-page.php [R=301,L]

example.pl/testリダイレクトするようにexample.pl/test-page.php

しかし、 example.pl/test/にリダイレクトしますexample.pl/

example.pl/test/にリダイレクトする必要があります が、example.pl/test-page.php

/url/url/リダイレクトの両方を処理するには?

末尾にスラッシュが付いている必要があると思います。

4

2 に答える 2

1

これを試して:

RewriteEngine On
RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 
RewriteRule ^test$ test-page.php [R=301,L]

ここでテスト済み。

于 2014-01-04T13:11:55.290 に答える
1

/?$正規表現を使用して末尾のスラッシュをオプションにする必要があります。次のルールを試してください。

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.pl [NC]
RewriteRule ^ http://%1.pl%{REQUEST_URI} [R=301,L]

RewriteRule ^test/?$ test-page.php [NC,R=301,L]

301 キャッシュの問題を回避するために、新しいブラウザーでこれをテストしてください。

于 2014-01-04T13:52:51.657 に答える