2016-08-04 47 views
0

让我带你到This page with HTTPSthis page without。这是一个Wordpress网站,不管怎样,URL(和链接到)都需要HTTPS://在前面,否则最终会出现一个空白页面。为什么前面没有“https://”的URL会导致空白页面?

让我们概括一下情况并澄清发生了什么,因为我不知道是什么原因造成的。希望你们可以告诉我如何解决这个问题,所以没有https://的URL仍然显示相同的页面?

可能的.htaccess/nginx.conf和重定向到 '以https://' 会做>

服务器运行的是NGINX

我的nginx.conf文件:

# HTTP -> HTTPS 
    server { 
    listen 80; 
    server_name ttr.nl www.ttr.nl; 
    return 301 https://ttr.nl$request_uri; 
    } 

    http { 
     client_max_body_size 100m; 
    } 
    # BEGIN W3TC Page Cache cache 
    location ~ /wp-content/cache/page_enhanced.*html$ { 
     expires modified 7200s; 
     add_header X-Powered-By "W3 Total Cache/0.9.4.1"; 
     add_header Vary "Accept-Encoding, Cookie"; 
     add_header Pragma "public"; 
     add_header Cache-Control "max-age=7200, public"; 
    } 
    location ~ /wp-content/cache/page_enhanced.*gzip$ { 
     gzip off; 
     types {} 
     default_type text/html; 
     expires modified 7200s; 
     add_header X-Powered-By "W3 Total Cache/0.9.4.1"; 
     add_header Vary "Accept-Encoding, Cookie"; 
     add_header Pragma "public"; 
     add_header Cache-Control "max-age=7200, public"; 
     add_header Content-Encoding gzip; 
    } 
    # END W3TC Page Cache cache 
    # BEGIN W3TC Browser Cache 
    gzip on; 
    gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon; 
    location ~ \.(css|htc|less|js|js2|js3|js4)$ { 
     expires 2592000s; 
     add_header Pragma "public"; 
     add_header Cache-Control "max-age=2592000, public"; 
     add_header X-Powered-By "W3 Total Cache/0.9.4.1"; 
    } 
    location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ { 
     expires 7200s; 
     add_header Pragma "public"; 
     add_header Cache-Control "max-age=7200, public"; 
     add_header X-Powered-By "W3 Total Cache/0.9.4.1"; 
    } 
    location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|woff|xla|xls|xlsx|xlt|xlw|zip)$ { 
     expires 31536000s; 
     add_header Pragma "public"; 
     add_header Cache-Control "max-age=31536000, public"; 
     add_header X-Powered-By "W3 Total Cache/0.9.4.1"; 
    } 
    # END W3TC Browser Cache 
    # BEGIN W3TC Page Cache core 
    set $w3tc_rewrite 1; 
    if ($request_method = POST) { 
     set $w3tc_rewrite 0; 
    } 
    if ($query_string != "") { 
     set $w3tc_rewrite 0; 
    } 
    if ($request_uri !~ \/$) { 
     set $w3tc_rewrite 0; 
    } 
    if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") { 
     set $w3tc_rewrite 0; 
    } 
    if ($http_cookie ~* "(w3tc_preview)") { 
     set $w3tc_rewrite _preview; 
    } 
    set $w3tc_ssl ""; 
    if ($scheme = https) { 
     set $w3tc_ssl _ssl; 
    } 
    set $w3tc_enc ""; 
    if ($http_accept_encoding ~ gzip) { 
     set $w3tc_enc _gzip; 
    } 
    set $w3tc_ext ""; 
    if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_ssl$w3tc_rewrite.html$w3tc_enc") { 
     set $w3tc_ext .html; 
    } 
    if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_ssl$w3tc_rewrite.xml$w3tc_enc") { 
     set $w3tc_ext .xml; 
    } 
    if ($w3tc_ext = "") { 
     set $w3tc_rewrite 0; 
    } 
    if ($w3tc_rewrite = 1) { 
     rewrite .* "/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_ssl$w3tc_rewrite$w3tc_ext$w3tc_enc" last; 
    } 
    # END W3TC Page Cache core 

    #gzip via varvy.com 
+0

听起来确实像一个htaccess问题。前一段时间我和我的SMF论坛有同样的问题,那就是问题所在。 –

+0

期望的结果是重定向非https https?或者使http和httpS工作?无论哪种方式,请发布您的htaccess文件 –

+0

我希望我的网站仅使用SSL,无论您将“https://”放在URL前面,它都应该可以正常工作。 –

回答

2

对这些URL中的每一个的请求将转到服务器上的其他端口。

很可能(但不是必需)同一部分软件正在侦听两个端口上的请求。如果不同的软件(例如Apache和Lighttpd)在不同的端口上侦听,则每个软件都需要配置为单独做你想做的事情。

如果它是同一块软件,那么每个端口将会有不同的配置(必须有一个需要打开SSL,另一个不能)。

这些不同的配置可能有任何数量的差异,例如不同的DocumentRoot。 OTOH,他们可以轻松共享大量的配置数据。


您应该如何解决这个问题的一般情况是:配置HTTP URL以发出301重定向到匹配的HTTPS URL。

的具体情况如何您修复它将取决于如何设置服务器。

+0

我只是打电话给我们的服务器部门,因为我只做前端。但是在我们的电话中,我们注意到 - 有些页面在两种情况下都可以工作(带和不带https://)。所以我想不是服务器相关的,但更多的网站相关。而且..我不确定现在在哪里搜索。 - 尽管如此,按照SO的要求,这个问题是特定的而不是一般的。 –

+0

嗨昆汀,我做了一些进一步的调查,但显然有些网页只有这个问题,而不是所有的网页。所以我认为这不是服务器相关的,而是Wordpress或服务器本身的设置。但是与服务器配置没有直接关系,比如端口。 你有任何其他想法可以解决这个问题吗? –

相关问题