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.
我在 xyz.com 有一个站点,出于某些原因,我想将对 www.xyz.com 的访问重定向到 url xyz.com。即使他们添加了“www”,我也想将他们栏中的地址更改为 xyz.com。有办法吗?
首先在您的 Web 服务器中启用 mod_rewrite,然后在您的目录中使用 .htaccess 文件,其中包含以下内容:
RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.xyz\.com$ RewriteRule ^(.*)$ "http\:\/\/xyz\.com\/$1" [R=301,L]