2014-12-06 108 views
0

我试图部署使用Jekyll的网站。为了方便我wan't到:重写到子文件夹htaccess

  • 克隆从我的GitHub库
  • 构建具有杰基尔
  • 到_site文件夹重定向访问

我一直在寻找的网站,但没有左右我找到的解决方案的工作。

的URL是这样的:

https://example.com/repo-folder/_site/

我当然希望观众只看到:

https://example.com/repo-folder/

在地址栏中,但服务于_site的所有文件夹。

我有什么要写入s htaccess文件,它应该放在哪里?

回答

1

在回购的文件夹,你可以尝试添加以下规则:

RewriteEngine On 

RewriteCond %{THE_REQUEST} ^(?:GET|POST)\ /+(.+?/?)_site/([^\?\ ]*) 
RewriteRule^/%1%2 [L,R] 

RewriteCond $1 !^_site 
RewriteRule ^(.*)$ _site/$1 [L] 
+0

感谢您的帮助。我非常感谢,但这不起作用。它会将_site文件夹重写为repo文件夹。 你可以在这里看看https://interface.fh-potsdam.de/eingabe-ausgabe/ 当我打电话给https://interface.fh-potsdam.de/eingabe-ausgabe/_site文件夹时,它重定向到https://interface.fh-potsdam.de/eingabe-ausgabe/网址。但我希望在该网址下为网站内容提供服务。 – fabianmoronzirfas 2014-12-06 20:17:01

+0

@fabiantheblind在第二个重写条件 – 2014-12-06 20:23:25

+0

中还有一个流浪'%'仍然是一样的。这可能是文件在该位置存在的问题吗? eingabe-ausgabe/_site/index.html和eingabe-ausgabe/index.html都存在。这就是为什么.yaml头可见 – fabianmoronzirfas 2014-12-06 20:32:43