0

mod書き換えルールを介してURLをリダイレクトしたいだけです。(R=301) を除いてこのルールを適用しました。

例 : http:///webapp/wcs/stores/servlet/en/marksandspencer から http:///en/marksandspencer へ


このルールを mod リダイレクト ルールに使用しています。

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^(/)?$ 
RewriteCond %{REQUEST_URI} !^/webapp.*$ 
RewriteCond %{REQUEST_URI} !^/wcsstore.*$ 
RewriteRule ^/(.*)$ /webapp/wcs/stores/servlet/$1 [PT,NC,L,QSA] 
RewriteRule ^/webapp/wcs/stores/servlet/(.*) /$1 [NE,L,QSA] 
RewriteRule ^(/)?$ /webapp/wcs/stores/servlet/en/marksandspencer [PT,NC,L]
4

1 に答える 1

0

何をしようとしているのかわかりませんが、Apache 2.0以降を使用している場合、。内で照合が行われると、先頭のスラッシュがURIから削除されますRewriteRule/webapp/wcs/stores/servlet/また、 URIの先頭にを追加しているように見えるルールがあり、次のルールはそれを削除しているように見えます。これにより、おそらくループが発生します。

何をしようとしているのかを大まかに推測すると、2番目のルールに条件を追加し、先頭のスラッシュを削除する必要があると思います。

# internally rewrite URI by appending "/webapp/wcs/stores/servlet/" to the front
RewriteCond %{REQUEST_URI} !^(/)?$ 
RewriteCond %{REQUEST_URI} !^/webapp.*$ 
RewriteCond %{REQUEST_URI} !^/wcsstore.*$ 
RewriteRule ^(.*)$ /webapp/wcs/stores/servlet/$1 [PT,NC,L,QSA] 

# if a request is made with "/webapp/wcs/stores/servlet/" in it, redirect to a URI with it stripped
RewriteCond %{THE_REQUEST} ^(GET/POST)\ /webapp/wcs/stores/servlet/
RewriteRule ^webapp/wcs/stores/servlet/(.*) /$1 [R=301,L,QSA] 

RewriteRule ^$ /webapp/wcs/stores/servlet/en/marksandspencer [PT,NC,L]
于 2012-07-03T22:23:49.133 に答える