繁体   English   中英

当 htaccess 不起作用时,如何在 Wordpress 子域上重定向 url?

[英]How can I redirect an url on a Wordpress subdomain when htaccess does not work?

每次我在 Firefox 中打开我的网站时,一个不需要的重定向会将站点从没有 www-prefix 的 url 引导到带有 www-prefix 的 url。 这会导致有关不安全站点的警告,但仅在 Firefox 中。

The site is actually a Wordpress subdomain, so sub.domain.com redirects to https://www.sub.domain.com (with www-prefix), while I want it to redirect to https://sub.domain.com (没有 www 前缀)。

我试图用 WordPress 插件和 htaccess 中的不同代码来摆脱这种重定向,但我没有做对。

我的 htaccess 文件的内容是:

...

    # 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
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    #RewriteEngine On
    #RewriteCond %{HTTP_HOST} ^http://www\.domain.com\/ [NC]
    #RewriteRule ^(.*)$ http://sub.domain.com/$1 [R=301,L]


    RewriteEngine On
    Redirect 301 /www.sub.domain.com/ 
    http://sub.domain.com/

...

有什么建议我 go 错了吗?

此致,

路德

这不是 Wordpress 问题,而是 Firefox 问题。 我有同样的问题。 解决办法是关闭域名补全:

  1. 在地址栏中输入about:config ,然后按 Enter。
  2. 可能会出现一个警告页面:单击接受风险并继续按钮继续。
  3. about:config页面顶部的 Search: 字段中键入fixup
  4. 双击browser.fixup.alternate.enabled首选项以将值更改为false

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM