2017-07-24 50 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 

希望它會幫助你:)

相關問題