Nginx and Apache的重写配置来支持html5的state跳转
2015-10-21 17:17
513 查看
原文链接:http://readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/
在nginx或者apache上面部署angular.js源码的时候刷新会产生404错误
1.apache 如果没有配置文件的权限,只能在htdocs目录下,将新建一个.htaccess文件,内容如下
2. nginx的配置文件里面增加try_files $uri $uri/ /index.html;
location / {
root C:/nginx-1.9.5/apps/web-console/build;
index index.html;
expires 30d;
try_files $uri $uri/ /index.html;
}
在nginx或者apache上面部署angular.js源码的时候刷新会产生404错误
1.apache 如果没有配置文件的权限,只能在htdocs目录下,将新建一个.htaccess文件,内容如下
RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L]
2. nginx的配置文件里面增加try_files $uri $uri/ /index.html;
location / {
root C:/nginx-1.9.5/apps/web-console/build;
index index.html;
expires 30d;
try_files $uri $uri/ /index.html;
}
相关文章推荐
- Apache Isis 1.4.0 发布,领域驱动开发框架
- Linux快速构建apache web服务器
- Awstats处理多apache日志
- 安装perl模块小窍门
- PHP+Apache在Windows 9x下的安装和配置
- Apache服务器配置全攻略
- Apache Web让JSP“动”起来
- Linux Apache+MySQL+PHP
- 建立Apache+PHP+MySQL数据库驱动的动态网站
- apache 环境下 php 的配置注意事项
- 在RedHat下安装apache jserv 1.1.2方法
- windows中PHP5.2.14以及apache2.2.16安装配置方法第1/2页
- 在Windows XP下安装Apache+MySQL+PHP环境
- 解析阿里云ubuntu12.04环境下配置Apache+PHP+PHPmyadmin+MYsql
- apache rewrite防盗链三例
- Apache 配置详解(最好的APACHE配置教程)
- Apache+php+mysql在windows下的安装与配置(图文)第1/2页
- apache rewrite_module模块使用教程
- Apache rewrite重写规则的常见应用
- 关于Apache默认编码错误 导致网站乱码的解决方案