简体   繁体   中英

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

Everytime I open my website in Firefox an unwanted redirection directs the site from an url without the www-prefix to an url with the www-prefix. This results in a warning about an unsafe site, but only in 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 (without www-prefix).

I tried to get rid of this redirection with WordPress plugins and with differen codes in htaccess, but I don't get it right.

The contents of my htaccess file is:

...

    # 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/

...

Any suggestions where I go wrong?

Best regards,

Ruud

It's not a Wordpress problem, it's a Firefox problem. I had the same problem. The solution is to turn off domain name completion :

  1. Type about:config in the address bar and press Enter.
  2. A warning page may appear: click the Accept the risk and continue button to proceed.
  3. Type fixup in the Search: field located at the top of the about:config page.
  4. Double-click the browser.fixup.alternate.enabled preference to change the value to false .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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