.htaccess 重定向到带有锚链接的页面 [英] .htaccess redirect to page with anchor link

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

问题描述

我正在尝试设置 .htaccess 文件以将页面从一个域重定向到另一个域.在 99% 的情况下都有效,不起作用的 RewriteRules 如下所示 - 如果出站 URL 具有 #anchor 标签,# 符号在浏览器中被转换为字符 %23,然后页面不会加载在锚.关于如何正确解释 # 标签的任何想法?

I'm trying to set up a .htaccess file to redirect pages from one domain to another. Works in 99% of cases, the RewriteRules that aren't working are like the one below - if the outbound URL has an #anchor tag, the # symbol is converted into the characters %23 in the browser and then the page does not load at the anchor. Any idea on how to interpret the # tag correctly?

AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
Options -MultiViews
Options +FollowSymlinks
RewriteEngine on
RewriteRule bg/row_b1_i_pn1.php http://example.org/s-b-g/b-1#illustration-110

如果我剪切并粘贴 "http://example.org/sbg/b-1#illustration-110" 直接进入我的浏览器,它加载得很好,但是使用 RewriteRule,加载的 URL 是 "http://example.org/sbg/b-1%23illustration-110" ...新站点是一个drupal站点,如果有帮助的话.谢谢.

If I cut and paste "http://example.org/s-b-g/b-1#illustration-110" into my browser directly, it loads just fine, but using the RewriteRule, the URL that loads is "http://example.org/s-b-g/b-1%23illustration-110" ... The new site is a drupal site, if that helps any. Thanks.

推荐答案

尝试使用 NE 标志:

Try it with the NE flag:

RewriteRule bg/row_b1_i_pn1.php http://example.org/s-b-g/b-1#illustration-110 [NE]

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

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