2017-03-17 216 views
1

所以我的主域是建立在wordpress平臺上的。我建立了一個不是基於wordpress平臺的自定義網站。我所要做的就是託管我在子域上構建的網站。因此,它應該是這樣的:將子域添加到Wordpress主站點

www.subsomain.maindomain.com

我已經上傳我的文件到subdomain文件夾和所有工作。進入subdomain.maindomain.com即當沒有www版本

我的問題

我的網站能正常工作。

但是,只要我嘗試將我的網站重定向到www。 subdomain.maindomain.com我得到一個DNS服務器未找到錯誤。

因此,我的NON www版本可以工作,但是當我嘗試運行WWW版本時,它不起作用。

我做了什麼。

  1. 重定向子域到www版本交友(沒有工作)
  2. 變化the.htaccess文件,嘗試多種調整和變化(沒有工作)
  3. 我叫GoDaddy的經紀人告訴我,因爲主網站在wordpress平臺上運行我需要進入mainsites wordpress數據庫並在那裏進行修改以使www版本的subdoman工作......? (這是正確的,它不使澀澀我..?)

這裏是我當前的.htaccess

RewriteEngine on 

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

# Redirect to another domain: example.com. 
RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC] 
RewriteRule .* http://example.com%{REQUEST_URI} [R=301,L] 
# Same for HTTPS: 
RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC] 
RewriteRule .* https://example.com%{REQUEST_URI} [R=301,L] 

所有我想做的事就是我的子域重定向到www版本任何幫助讚賞

回答

0

它不起作用,因爲www.subsomain.maindomain.com不存在。您必須按照您將主機子域添加到maindomain.com的相同方式,在您的區域subsomain.maindomain.com中添加CNAME記錄。

相關問題