Backbone.js的路由器使用pushstate与本地主机上的XAMPP Apache服务器机上、路由器、地主、与本

由网友(我只想给你宠爱)分享简介:我试图让Backbone.js的的路由器在本地主机上我的XAMPP的Apache服务器的工作。I'm trying to get backbone.js's router to work with my XAMPP apache server on localhost.我需要prevent阿帕奇的评估,都应该去路由...

我试图让Backbone.js的的路由器在本地主机上我的XAMPP的Apache服务器的工作。

I'm trying to get backbone.js's router to work with my XAMPP apache server on localhost.

我需要prevent阿帕奇的评估,都应该去路由器,只是期待一切 /test_backbone/index.html 的目录路径。我尝试了一切,我能找到的,没有任何工程。

I need to prevent apache from evaluating the directory paths that are supposed to go to the router and just forward everything to /test_backbone/index.html. I've tried everything that I could find, nothing works.

目前,我已经在httpd.conf文件:

Currently, I have this in httpd.conf file:

# html5 pushstate (history) support:
<ifModule mod_rewrite.c>
  Options +FollowSymLinks
  IndexIgnore */*
  # Turn on the RewriteEngine
  RewriteEngine On
  #  Rules
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule (.*) /test_backbone/index.html
</ifModule>

我也试过这样的:

I've also tried this:

# html5 pushstate (history) support:
<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !index
    RewriteRule (.*) index.html [L]
</ifModule>

我下的是IM pression,其中有些线路应该说,如果它存在加载静态文件,但没有我的JavaScript文件被加载,一切都只是回到 /test_backbone/index.html

我也试过的.htaccess 文件。据我所知,我还没有把这个code。在正确的地方。

I've also tried .htaccess files. For all I know I'm not even putting this code in the right place.

任何帮助将是很大的AP preciated!

Any help would be greatly appreciated!

推荐答案

您的配置应该工作。当修改的httpd.conf 你需要重启apache 无修改时需要重新启动的.htaccess

Your configuration should work. When modifying httpd.conf you need to restart apache No need for restart when modifying .htaccess.

为以防万一,尝试了[L]标志添加到重写规则的的httpd.conf ,所以停止了比赛后处理其他规则。

Just in case, try to add the '[L]' flag to the Rewrite Rule in the httpd.conf, so it stops processing more rules after that match.

阅读全文

相关推荐

最新文章