0

Right now *.foo.com and *.bar.com are aliased to the same vhost with LAMP. Right now it, of course, shows the same content with every URL. But I don't actually want this to be what happens, and I want the other domains to actually redirect to foo.com. I'm assuming this is possible with the .htaccess file.

EDIT: I'm hosting this on my own server, so I'd also like the IP address to redirect to foo.com

4

1 に答える 1

1

.htaccess で書き換え条件を使用して、foo.com 以外のすべてを選択し、次にリダイレクトします。

RewriteEngine On
RewriteCond %{HTTP_HOST} !^foo\.com$
RewriteRule ^(.*)$ http://foo.com/$1 [R=301,L]
于 2013-04-29T12:11:39.740 に答える