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.
我将更改我的一个子域的 CNAME 记录,但我需要将来自此的所有流量(包括文件、页面等)重定向到新域上的新页面。
示例:将所有流量从 xxx.example.com 重定向到 www.example.com/xxx/xxx
通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccess的DOCUMENT_ROOT目录下:
httpd.conf
.htaccess
DOCUMENT_ROOT
Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteCond %{HTTP_HOST} ^xxx\.xxx\.com$ [NC] RewriteRule ^(.*)$ http://www.xxx.com/xxx/xxx/$1 [R=301,L]