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

查看:50
本文介绍了.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是"

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 标志:

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

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

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