.htaccess 在htaccess中,如何使无www多个域成为一个根目录

.htaccess 在htaccess中,如何使无www多个域成为一个根目录,.htaccess,rewrite,.htaccess,Rewrite,我有两个指向同一根的域,我想强制它们没有www前缀: www.tapirhostel.pl www.tapirhostel.com 现在我有这样的东西: RewriteCond %{HTTP_HOST} ^www\.tapirhostel\.pl$ [NC,OR] RewriteCond %{HTTP_HOST} ^www\.tapirhostel\.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^tapirhostel\.pl$ [NC,OR] Rewri

我有两个指向同一根的域,我想强制它们没有www前缀:

www.tapirhostel.pl
www.tapirhostel.com
现在我有这样的东西:

RewriteCond %{HTTP_HOST} ^www\.tapirhostel\.pl$  [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.tapirhostel\.com$  [NC,OR]
RewriteCond %{HTTP_HOST} ^tapirhostel\.pl$  [NC,OR]
RewriteCond %{HTTP_HOST} ^tapirhostel\.com$  [NC]
RewriteCond %{REQUEST_URI} !^/tapirhostel/.*$
当我在没有www的情况下进入时,一切正常。 当你在前面输入“www”时,问题就开始了。当你输入时,它会很好地重定向到,但当我输入时,它会将我重定向到。 有什么想法吗?

这应该行得通

Options +FollowSymLinks
RewriteEngine on

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

RewriteCond %{HTTP_HOST} ^www\.tapirhostel\.com [NC]
RewriteRule ^(.*)$ http://tapirhostel.com/$1 [R=301,L]

你其余的规则在哪里?这些只是条件