Re: htaccess redirect URL fragment problem with Safari browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert,

Your first quote simply states that the characters after the hash sign cannot be extracted by mod_rewrite. Nothing else. That guide even gives you a workaround.

The second link can be circumvented with the [NE] flag. In any case, try this simple ruleset on your server (directly in one of your vhosts, or in the main configuration, if you don't have vhosts):

RewriteEngine on
RewriteRule ^/foo http://www.google.com/#name_of_anchor

It works with FF, IE, Konq, and many more browsers.

Your 'does not work' claim is dubious at best. How about you give us a link to a page where the rewriting takes place, and we'll try to open it with Safari from here?

Frank

Robert T Wyatt wrote:
Hi Frank,

I'm not trying to be dense or contentious; I don't understand why this is working with all browsers except Safari. I do understand that it shouldn't work at all since I've now found:

http://httpd.apache.org/docs/2.2/misc/rewriteguide.html
"The Apache kernels URL escape function also escapes anchors, i.e. URLs like "url#anchor". You cannot use this directly on redirects with mod_rewrite because the uri_escape() function of Apache would also escape the hash character."

Even redirecting to an anchor is problematic:
http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.html#redirectanchors "By default, redirecting to an HTML anchor doesn't work, because mod_rewrite escapes the # character, turning it into %23. This, in turn, breaks the redirection."

So I understand why it doesn't work with Safari. Why does it work with other browsers?

Best,
Robert


Frank Gingras wrote:
Robert,

"May be"? I told you now three times that it cannot be captured. Were you listening to me?

Robert T Wyatt wrote:
Well, here's the example:
http://www.utexas.edu/student/registrar/schedules/092/regrules/all.html#acc

Try this with several browsers and you'll find that it only fails to pass the anchor on Safari....

Anyhow, I'm afraid that I am trying to capture the anchor and pass it through to the redirected URL so I may be out of luck.

Thanks,
Robert

Frank Gingras wrote:
Robert,

You CAN enter the URL directly in a browser, and the page 'should' scroll down to the anchor (<a name='foo'>). A sample URL would be: http://hostname/foo#bar.

Now, a rule is allowed to redirect to an anchor. It simply cannot match or capture it.

To address your issue with Safari, I have several co-workers that use it, and they never reported that issue.

Robert T Wyatt wrote:
Thanks Frank,

What I'm hearing is that the redirection is using a RegEx and that the
hash character cannot be a player. Furthermore, the fact that this
works on most browsers (but fails on Safari) is due to them being not
strictly compliant.

Is that about it?

Thanks,
Robert

Frank Gingras wrote:
Hello Robert,

Actually, the # in the URI indicates an anchor, not a comment. They
cannot be matched on, nor captured.

Frank




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux