Focus on cloud service provider activities
Notes on website operation and maintenance

Resolve the problem of WordPress website jump with or without WWW

When we set up a website with wordpress, do we sometimes find that it can be opened by entering WWW and addresses without WWW? In the past, when I configured a website with WWW or without WWW, I only need to set two unified addresses in the background. I met a website these days and found that this is not the case. Even if the WWW domain name is set, it will not work if you open it with a domain name without WWW.

How to deal with it? Of course, there are methods. We can implement them by using plug-ins. In view of the principle of using fewer plug-ins, we still don't want to use them. We can modify it in the htaccess file.

# BEGIN WordPress
<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

The above is the content of our original HTACCESS file. We need to add:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^laozuo.org [NC] RewriteRule ^(.*)$ https://www.laozuo.org/ $1 [L,R=301]

The web address is changed to your own. We need to pay attention to one problem. Do not update at the fixed connection of the background. After you update, it will be restored. If it needs to be adjusted in time after updating.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Resolve the problem of WordPress website jump with or without WWW


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge