[Techtalk] Moving Websites: 301 Redirect

Sheila Fenelon sheila at shefen.com
Mon Jun 7 14:38:13 UTC 2010

chris wrote:
> really? you couldn't write a php function that would pull the
> #namedanchor out of the browser url request?

Nope, can't be done. The #namedanchor is never sent to the server.

> I know you can do that in ruby/rails and I think even javascript.
> It's been a little while since I mucked around with php

I think you are mistaken about Ruby. It doesn't have access to any more
information from Apache than any other CGI language.

PHP and Ruby are server-side. JavaScript is client-side. The only way to
rewrite (change) how the #namedanchor is handled has to be done on the
client-side, i.e., with JavaScript.

Chris you said it yourself:

>> chris wrote:
>>> Hi Sue, the internal anchor link is navigated by the visitor's
>>> user agent and will be ignored by mod_rewrite.

Strictly speaking mod_rewrite doesn't ignore #namedanchor, it never gets
a chance to ignore it, since Apache never see it.

> Also, re: just changing the links - I'm sure that's not the issue and
> easily done with a little scripting. The issue would be all inbound
> links to the named anchors of those urls.  It would be poor practice
> to rearchitect a website and not provide redirects from the old
> architecture to the new.

Poor architecture or not, if it can't be done, it can't be done.

Sheila Fenelon

More information about the Techtalk mailing list