我有一个文件夹,我放在Laravel网站的/ public文件夹中.路径是:
/public/test
Run Code Online (Sandbox Code Playgroud)
"test"文件夹有一个名为index.html的文件,它只是我想从公共文件夹加载的静态资源(我不想在框架内为此创建一个视图 - 太多无法解释).
我做了这样的路线:
Route::get('/test', function() {
return File::get(public_path() . '/test/index.html');
});
Run Code Online (Sandbox Code Playgroud)
我无法让它发挥作用.我刚收到Chrome的错误,说这个页面有一个重定向循环.
我可以这样访问它:
http://www.example.com/test/index.html
Run Code Online (Sandbox Code Playgroud)
但我不能在任何地方使用.html扩展名.该文件必须显示为:
http://www.example.com/test/
Run Code Online (Sandbox Code Playgroud)
如何在不使用.html扩展名的情况下从Laravel公用文件夹提供单个HTML页面?
我在OS X 10.9(Mavericks)上运行Apache/2.2.24的本地开发机器上设置了一些虚拟主机.
我的http-vhosts.conf文件(配置为通过httpd.conf加载)如下所示:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/me/Sites/testsite.com
ServerName testsite.dev
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/me/Sites/testsite2.com
ServerName testsite2.dev
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
我还配置了我的/ etc/vhosts文件来包含这一行:
127.0.0.1 testsite2.dev
Run Code Online (Sandbox Code Playgroud)
我希望能够通过SSL(https)使用testsite2.dev.我已经尝试了多个配置的vhosts配置文件,没有运气.
使用当前配置,转到http://testsite2.dev会拉出我期望的页面,而https://testsite2.dev指向/Library/WebServer/Documents/index.html.en上的apache主页
我尝试了以下配置,以及其他多个不起作用的配置:
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/me/Sites/testsite.com
ServerName testsite.dev
</VirtualHost>
<VirtualHost *:80 *:443>
DocumentRoot "/Users/me/Sites/testsite2.com
ServerName testsite2.dev
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
是否可以让虚拟主机侦听本地计算机上的端口80和端口443?
Google+允许开发人员利用他们称之为"显式呈现"的内容,仅在页面上发生特定事件时才显示Google+按钮(请参阅:http://code.google.com/apis/+1button/#example-explicit - 渲染).这在需要多个按钮的页面上非常有用.
然而,Twitter在页面上每个链接的位置使用类"twitter-share-button"呈现推文按钮(使用iframe).这会导致非常慢的页面加载(即使我在加载DOM后异步加载Twitter的widget.js).
有没有人知道模仿用于Tweet按钮的Google+显式渲染的方法,或仅在发生某个DOM事件时呈现Tweet按钮的方式(如鼠标悬停)?
apache ×1
google-plus ×1
https ×1
javascript ×1
laravel ×1
php ×1
ssl ×1
twitter ×1
virtualhost ×1