使用.htaccess文件与哈希重定向URL [英] Redirect URL with hash using .htaccess file

查看:194
本文介绍了使用.htaccess文件与哈希重定向URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重定向包含哈希到另一个网址的URL。

I'm trying to redirect a url containing an hash to another url.

例:example.com/#test应该重定向到example.com/teste_page~~V

Example: example.com/#test should redirect to example.com/teste_page

可以这样使用htaccess的文件来完成?

Can this be done using htaccess file ?

推荐答案

没有,哈希值永远不会发送到服务器,它们在页面片段标识符,所以只能使用浏览器。所以,你的.htaccess永远不会有机会获得哈希值。你必须做一些漂亮的重定向来获取信息到服务器。

No, hashes are never sent to the server, they are in-page fragment identifiers, so only used by the browser. So you're .htaccess would never have access to the hash. You'd have to do some nifty redirects to get that info to your server.

这里有一些想法,可能会引发一些东西:

Here are some ideas that might spark something:

<一个href="http://forum.modrewrite.com/viewtopic.php?t=3912">http://forum.modrewrite.com/viewtopic.php?t=3912

这篇关于使用.htaccess文件与哈希重定向URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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