redirect - 通配符将所有潜艇重定向到根目录
问题描述
在过去的 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
解决方案
推荐阅读
- javascript - 单击多个元素时jQuery更改图标
- reactjs - 我应该将默认反应属性设置为 null
- java - 当我通过 Jenkins 使用 Maven 构建 Spring Boot 应用程序并执行 JAR 文件时,找不到类定义?
- firebase - firebase 设置后台消息处理程序
- python - 将全角 Unicode 字符转换为 ASCII 字符
- c# - 使用(IDisposable)与类字段 - ReaderWriterLockSlim 的正确用法
- angular - Angular 5 Jasmine 错误:预期一个匹配的条件请求未找到
- zshrc - .zshrc 配置中带有 var multi GOPATH 的 GOBIN 根设置
- opencv - 如何在此图像中查找圆圈数或对象数
- php - 在 Symfony 3 中使用预先存在的数据库登录