httpd.conf文件和HTML5 pushstate() [英] httpd.conf and HTML5 pushstate()

查看:129
本文介绍了httpd.conf文件和HTML5 pushstate()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行一个AJAX启用的网站,迎合了HTML4散列和HTML5 pushstate()。

I'm running an AJAX enabled site that caters for HTML4 hash and HTML5 pushstate().

我刚刚迁移到AWS EC2实例(Linux服务器上运行的Apache)和两个网站都运行正常。

I've just migrated to an AWS EC2 instance (linux server running apache) and both site are running fine.

我所遇到的唯一问题是,当我刷新HTML4散列页正确的页面显示。

The only issue I've experienced is when I refresh a HTML4 hash page the correct page shows.

然而,当我刷新如 http://www.datingjapan.co/conversations 一个HTML5页面我收到以下错误信息:

However when I refresh a HTML5 page like http://www.datingjapan.co/conversations I get the following error message:

看来,Apache是​​试图进入该文件夹converstations而就可以致电该网站的index.php',然后使用jQuery来加载正确的页面。

It appears that apache is trying to go into the folder 'converstations' rather then just call the site 'index.php' which then using jquery to load the correct page.

任何人都可以建议可能是什么问题在这里。我假设它的一个httpd.conf中设置。

Can anyone advise what might be the issue here. I'm assuming its a httpd.conf settings.

THX

推荐答案

如果你想使用的index.php 文件作为某种类型的引导,你可能想试试这个在您的的.htaccess 文件:

If you're trying to use an index.php file as some type of bootstrap you might want to try this in your .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^(www\.).+$ [NC]
    RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

基本上,这将非www的所有请求重定向到www,然后如果它不是一个文件或目录,将请求转发到的index.php 文件。

这篇关于httpd.conf文件和HTML5 pushstate()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆