我与AngularJS使用pushstate,但我有一些与htaccess文件的问题。 这是HTML5mode为false的url:
http://127.0.0.1/mpu/#!/Roma/home(Roma是一个variables)
目前我正在使用这个:
<ifModule mod_rewrite.c> Options +FollowSymLinks IndexIgnore */* RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.html </ifModule>
结果,我有这个: http : //127.0.0.1/mpu/home
Apache .htaccess <目录不允许在这里
RewriteRule for .html / RK = 0 / RS =
从url中删除'index.html',并用一个301redirect添加'www'
.htaccess文件不存在时redirect
但是相反,我需要与“罗姆人”之后的mpu
任何人都可以帮我写正确的htaccess吗?
.htaccess重写规则,以防止caching的CSS,JS,图像文件。
rewrite_mod已启用,但.htaccess不起作用
提交此表单时如何隐藏用户的url?
使用htaccess修复拼写错误的url
请求实体太大的PHP
我建议你阅读这篇文章https://ngmilk.rocks/2015/03/09/angularjs-html5-mode-or-pretty-urls-on-apache-using-htaccess/
更新
RewriteEngine on RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^ index.html [L]
这是我的虚拟主机(我在Windows上使用Xampp)。
转到C: xampp apache conf extra并编辑httpd-vhosts.conf文件,并且不要忘记在您的主机文件中添加127.0.0.1 example.local
<VirtualHost *:80> serverName example.local DocumentRoot "C:xampphtdocsYOUR_PROJECT_FOLDER" <Directory "C:xampphtdocsYOUR_PROJECT_FOLDER"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
重新启动Apache服务器,你很好去。
var Config = function($locationProvider,$stateProvider,$urlRouterProvider){ $stateProvider .state('home',{ url : '/',templateUrl : 'home.html' }) .state('city',{ url : '/:city/home',templateUrl : 'city.html' }); $urlRouterProvider.otherwise('/'); $locationProvider.html5Mode(true); }; Config.$inject = [ '$locationProvider','$stateProvider','$urlRouterProvider' ]; app.config(Config);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。