首页 > 解决方案 > 通配符将所有潜艇重定向到根目录

问题描述

在过去的 20 分钟里,我一直在让自己头疼,因为我在处理不同的线程,比如将所有通配符子域重定向到根域 以及其他谷歌搜索和测试..我很确定我只是在做一些非常愚蠢的新手,希望有人能在这里启发我。 ..

我希望我拥有的域上的所有旧子域都 301 重定向到主域的根...我想我不知道在哪里输入代码调整或者我误解了其他东西...

这就是我的 htaccess 中适用于 root 的内容......但是我基于其他线程添加的任何内容以重定向 subs 都给了我错误

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php80” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

我正在为潜艇尝试什么?

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^(.+)\.ourtrustedadvisor\.com$ [NC]
RewriteRule (.*) http://ourtrustedadvisor.com/$1 [L,R=301,QSA]
</IfModule>

# END WordPress
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php80” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

标签: redirect

解决方案


推荐阅读