服务404不重定向到/ 404 / [英] Serving a 404 without redirecting to /404/

查看:114
本文介绍了服务404不重定向到/ 404 /的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有供应的网址,如...

I have a web application that serves urls such as...

http://domain.com/#!/this-is-a-parameter

我想从 http://domain.com/this-is-a-parameter 重定向到我的!#版本。我知道,htaccess的不能重定向到散列,所以我的问题是:

I want to redirect from http://domain.com/this-is-a-parameter to my !# version. I know that htaccess can't redirect to hashes, so my question is:

我如何做htaccess的服务于404与我的JS重定向code,不改变网址是什么?我所有的努力都导致重定向到404.html,剥离了必要的数据进行重定向。

How do I make htaccess serve a 404 with my js redirect code, without changing the url? All my attempts have resulted in redirection to 404.html, which strips out the necessary data to perform the redirect.

推荐答案

您想要的:

RewriteRule ^(.+)$ http://domain.com/#!/$1 [L,R,NE]

您需要的 NE 让哈希没有得到EN codeD。

You need the NE so that the hash doesn't get encoded.

这篇关于服务404不重定向到/ 404 /的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆