Hexo-theme-next: 部署到github后点击菜单栏跳转至http而非https

Created on 22 Oct 2016  ·  21Comments  ·  Source: iissnan/hexo-theme-next

https://goldymark.github.io/

如上,是我部署的blog,点击Program后会跳转至http开头的url地址,而不是https,搜了一下issues,发现都没有解决这个问题,请问怎样才能正常访问?谢谢。

Most helpful comment

@toutoudnf 我试过,还是一样,除非浏览器强制https,但我在其他电脑打开还是一样,我不能保证看的人都强转了。

改不改这个配置,菜单跳转先到https,我chrome f12 查看过,它请求是https,返回code 301 Moved Permanently (from disk cache) ,然后跳转到http

经过我仔细对比,请求https://zonas0574.github.io/categories 301;跳转到http://zonas0574.github.io/categories/,页面显示错误,然后我手动输入网址https://zonas0574.github.io/categories同样错误,当我再输入https://zonas0574.github.io/categories/时访问正常
因此我修改配置/categories --》/categories/ 更新网站,好像可以,也就是末尾多/

All 21 comments

为什么我这边看没问题。好僵

目前发现只有menu才有这个问题,首页的文章链接是没问题的。
而且查看生成的html发现,menu的href地址也是正确的(带https),但实际点击时却实际跳转到http:/xx.github.io/...。

发现以下两种情况下访问是正常的:

翻墙;
safari;

想知道当点击menu时会调用什么函数? @Neveryu

@GoldyMark 你的博客哪有menu?

由分类生成的menu
themes/next/_config.yml

menu:
  home: /
  program: /categories/program
  "music-drink": "/categories/music-drink"
  yiyan: /categories/一言
  categories: /categories
  archives: /archives

@Neveryu

@GoldyMark 我看了呀,我点进去都是 https ,没问题呀

我用chrome和FF访问都有问题,safari则无问题。

或者我开了lantern或ss之后访问,也是无问题的。

感觉跟GFW或浏览器策略有关。

所以想从点击menu时调用的函数入手看看能不能解决。

@Neveryu

我的safari访问你的有问题啊!我的网站也是这样https://pengshp.github.io

或许你可以试试这个插件,装了访问就没问题了https://www.eff.org/https-everywhere
@GoldyMark

好吧,我现在用safari访问自己的blog也有问题了……

这个插件只能让装了插件的人访问正常,但没装的访问还是有问题,不能治本。
@pengshp

@Neveryu 我的是https://toutoudnf.github.io/ ,也存在这个问题。。不知该如何定位或者解决哈~

btw~我是使用了shadowsocks,浏览器是chrome54.0.2840.71 m

我提过两个和这个相关,其中重装主题解决,过段时间又问题
这两个被我关,没人能解决
https://github.com/iissnan/hexo-theme-next/issues/1147
https://github.com/iissnan/hexo-theme-next/issues/1151

@zonas0574
我修改了配置文件如下:

menu:
  home: https://toutoudnf.github.io
  categories: https://toutoudnf.github.io/categories
  about: https://toutoudnf.github.io/about
  archives: https://toutoudnf.github.io/archives
  tags: https://toutoudnf.github.io/tags

这样在github上就可用了

@toutoudnf 我试过,还是一样,除非浏览器强制https,但我在其他电脑打开还是一样,我不能保证看的人都强转了。

改不改这个配置,菜单跳转先到https,我chrome f12 查看过,它请求是https,返回code 301 Moved Permanently (from disk cache) ,然后跳转到http

经过我仔细对比,请求https://zonas0574.github.io/categories 301;跳转到http://zonas0574.github.io/categories/,页面显示错误,然后我手动输入网址https://zonas0574.github.io/categories同样错误,当我再输入https://zonas0574.github.io/categories/时访问正常
因此我修改配置/categories --》/categories/ 更新网站,好像可以,也就是末尾多/

采用你的方案终于可以解决问题了!THX @zonas0574

解决就好~哈哈

zonas0574
···java
menu:
home: /
#categories: /categories
#about: /about
archives: https://gdutxiaoxu.github.io/archives/
tags: https://gdutxiaoxu.github.io/archives/tags
#sitemap: /sitemap.xml
#commonweal: /404.html

···
是修改成这样吗

@zonas0574
···java
menu:
home: /

categories: /categories

about: /about

archives: https://gdutxiaoxu.github.io/archives/
tags: https://gdutxiaoxu.github.io/archives/tags

sitemap: /sitemap.xml

commonweal: /404.html

···
是修改成这样吗

貌似,在github上进行配置就好了

Your Project-> Settings -> Enforce HTTPS

发件人: 徐俊 notifications@github.com
回复: iissnan/hexo-theme-next reply@reply.github.com
日期: 2016年12月9日 at 上午11:17:05
至: iissnan/hexo-theme-next hexo-theme-next@noreply.github.com
主题:  Re: [iissnan/hexo-theme-next] 部署到github后点击菜单栏跳转至http而非https (#1187)

@zonas0574
···java
menu:
home: /

categories: /categories

about: /about

archives: https://gdutxiaoxu.github.io/archives/
tags: https://gdutxiaoxu.github.io/archives/tags

sitemap: /sitemap.xml

commonweal: /404.html

···
是修改成这样吗


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@tonydeng

我的project是这样的,现在不能设置,还是访问不了

@gdutxiaoxu
在url末尾加上/,如下:

menu:
home: /
#categories: /categories/
#about: /about/
archives: https://gdutxiaoxu.github.io/archives/
tags: https://gdutxiaoxu.github.io/archives/tags/
#sitemap: /sitemap.xml
#commonweal: /404.html

好的,我试一下,谢谢

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ifgao picture ifgao  ·  4Comments

bingstyle picture bingstyle  ·  3Comments

YorksonChang picture YorksonChang  ·  3Comments

blueyi picture blueyi  ·  5Comments

payne4handsome picture payne4handsome  ·  4Comments