2017-07-24 82 views

回答

0

如果你只是想强制所有使用万维网,那么这应该做的伎俩。

# Needed before any rewriting 
RewriteEngine On 

# Redirect HTTP without www to HTTP with www 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 
# Redirect HTTPS without www to HTTPS with www 
RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

## 301 Redirects can go after this 
0

不要忘记在wp_options表中设置您的域或设置。

enter image description here

而且,放弃这一行你.htaccess

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^opcito.com [NC] 
RewriteRule ^(.*)$ http://www.opcito.com/$1 [L,R=301] 

RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 

希望它会帮助你:)