簡體   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