0

私は次のようなドメインを持っています: this.that.com (そこからもアクセスできます:) that.com/this

私がやりたいことは、サーバーが上記の 2 つの URL からのすべてのリクエストを this.com に転送するようにすることです。

必要なので、this.that.com と入力すると、this.com に自動転送されます

前もって感謝します。

4

1 に答える 1

1

To redirect all requests to this.com, match everything, which is not already this.com

RewriteEngine On
RewriteCond %{HTTP_HOST} !^this\.com$
RewriteRule .* http://this.com/$0 [R,L]

If you want to redirect to the main page instead, leave out the URL path

RewriteEngine On
RewriteCond %{HTTP_HOST} !^this\.com$
RewriteRule .* http://this.com/ [R,L]

If everything works as expected, you can switch to R=301 redirection.

于 2013-01-23T01:49:56.143 に答える