0

I tried to search this but due to the search terms I can not find an answer anywhere.

My visitor tracking site (I use Piwik) can not decipher between the following issue below.

example.com./ vs example.com/

example.com./ when types in to find a website is of course wrong, somehow others get to my site and every page they visit shows as an external link and this ./ problem.

How can I in .htaccess (in my root of my domain) add a rule to fix this problem and possibly others that are similar to this?

4

2 に答える 2

1

ホスト名が無効であり、その要求がサーバーに到達することはないため、htaccessこれはから修正できるものではありません。example.com.ブラウザからの送信リクエストをpiwikに書き換える方法はありません。これらのリクエストはサーバーとは関係がなく、htaccessは適用されないためです。

ブラウザがホスト名を使用して追跡情報をpiwikに送信している理由を理解する必要がありますexample.com.。知識のない野蛮な推測と同じように、それはホスト名のいくつかのエレガントでない追加と、のような不適切に形成された相対URIに関係している可能性があり<a href="./my/page.html">ます。したがって、コードが意図せずにそれらを一緒に追加すると、が得られexample.com./my/page.htmlます。

于 2012-10-19T02:46:30.910 に答える
0

HTTP_HOST 変数を使用してみてください。次のようなものが機能する可能性があります。

RewriteEngine on
Rewritecond %{HTTP_HOST} ^www\.example\.com\.
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
于 2012-10-18T21:34:34.190 に答える