mod_rewrite的锚链接 [英] mod_rewrite with anchor link

查看:252
本文介绍了mod_rewrite的锚链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你不能重定向锚网址到另一个网页,但有可能以一个URL重定向到只有一个锚?

于是

  http://www.example.com/video/ {标题}
 

总是被发送到

  http://www.example.com/video.php?title= {标题} #player
 

这是唯一改变的内容是标题,主播是永远不变的。我需要重定向到某个幻灯片上的尾滑

解决方案

 重写规则^ /视频/(.*)/video.php?title=$1#player [NE,L, R = 301]
 

NE | noescape

在默认情况下,特殊字符,如&放大器;和β,例如,将被转化成它们的十六进制code当量。使用[NE]标志prevents这种情况的发生。

来源: http://httpd.apache.org/docs/电流/ EN /重写/ flags.html

I know you can't redirect anchor URLs to another page, but is it possible to redirect a URL to only a single anchor?

So

http://www.example.com/video/{title}

always gets sent to

http://www.example.com/video.php?title={title}#player

The only thing that changes is the title, anchor is always the same. I need to redirect to a certain slide on a coda slider

解决方案

RewriteRule ^/video/(.*) /video.php?title=$1#player [NE,L,R=301]

NE|noescape

By default, special characters, such as & and ?, for example, will be converted to their hexcode equivalent. Using the [NE] flag prevents that from happening.

Source : http://httpd.apache.org/docs/current/en/rewrite/flags.html

这篇关于mod_rewrite的锚链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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