Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个网站,无论放置什么而不是“www”,该网站仍然有效:
IE。abc.example.com、w.example.com、www.example.com、ww.example.com 等
我需要做的是将所有这些重定向到“www”网址。
任何帮助都会有很大帮助
问候,
寿司
我想你正在寻找这样的东西:
重写引擎开启 RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] 重写规则 ^(.*)$ http://www.example.com/$1 [R=301,L]
这应该将某人在“example.com”上访问的任何不是www以 www 开头的 URL 开头的 URL 重写。请注意,您可以选择<IfModule mod_rewrite.c>在 mod_rewrite 被禁用或卸载的情况下使用。
www
<IfModule mod_rewrite.c>