httpd.conf文件和HTML5 pushstate()

编程入门 行业动态 更新时间:2024-10-27 12:41:24
本文介绍了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.

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

However when I refresh a HTML5 page like 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 ^(.*)$ 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()

本文发布于:2023-07-16 04:03:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117658.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   conf   httpd   pushstate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!