Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过Apache404提供的Ember/Ember Cli_Apache_Ember.js_Url Rewriting_Ember Cli - Fatal编程技术网

通过Apache404提供的Ember/Ember Cli

通过Apache404提供的Ember/Ember Cli,apache,ember.js,url-rewriting,ember-cli,Apache,Ember.js,Url Rewriting,Ember Cli,当我试图通过Apache为我的ember应用程序提供服务时,遇到了一个问题。因为位置被设置为“history”而不是“hash”,Apache正在尝试加载不作为文件存在的magic ember路由。myapp.com/login抛出404,因为没有login.html 我已经做了一些研究,但令人惊讶的是,在这方面的研究并不多,这让我相信没有多少人在apache上部署ember应用程序 所以建议我编写ApacheURL重写规则,但我尝试过的规则似乎不起作用 Options +FollowSymLi

当我试图通过Apache为我的ember应用程序提供服务时,遇到了一个问题。因为位置被设置为“history”而不是“hash”,Apache正在尝试加载不作为文件存在的magic ember路由。myapp.com/login抛出404,因为没有login.html

我已经做了一些研究,但令人惊讶的是,在这方面的研究并不多,这让我相信没有多少人在apache上部署ember应用程序

所以建议我编写ApacheURL重写规则,但我尝试过的规则似乎不起作用

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.html [L]

选项后面的符号链接
重新启动发动机
重写基/
重写规则^index\.html$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.html[L]
不要工作

除了回到“散列”,还有人知道该做什么吗


尊敬的,无知的人。

您需要将所有内容路由到索引,但现有文件除外:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html#$1 [L]

如果可以返回哈希,可以将locationType设置为“哈希”

查看下一个答案:


我也遇到了同样的问题,我对此进行了修复。

确保启用了“重写”模块(以防万一),在可用的情况下,使用HistoryLocation更像是ember方法,因此,虽然这在正常情况下可以工作,但我推荐Kitler的解决方案。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html#$1 [L]