Forum Moderators: phranque

Message Too Old, No Replies

How does one redirectmatch from a file to a bookmark in another file?

RedirectMatch 301 for examples.html to page.html#examples

         

Wizcrafts

6:29 am on Nov 16, 2004 (gmt 0)

10+ Year Member



I am dropping a webpage from my new server because it has very little content, and have pasted it's content into a related page, as a bookmarked hyperlink, as in:
<a name="examples">(text)
. I then changed the HTML link from (old page) examples.html to similarpage.html#examples, which works as expected.

Because the old page has been indexed for several years I want to send a RedirectMatch 301 to the S.E.s, so I tried adding this line to my .htaccess, but it results in a 404 file not found error:

RedirectMatch permanent examples\.html ht*p://www.mydomain.com/similarpage.html#examples
. However, if I click on an html link to that bookmarked item, it is correctly loaded into the browser, with the bookmarked section at the top of the Window. I also noticed that the addressbar shows that my # has been converted to %23.

Am I barking up the wrong tree trying to do this type of internal page-link ID redirect in .htaccess? If so, should I feed a 404 or 410 GONE to the S.E.s? Real people can still access the information by clicking on the html link in the Navbar, or in my site map.

Owner Edit:
I just remembered, in my sleepy state, that "#" is a Comment indicator in .htaccess. I changed the redirect linkage to %23, but it still fails to go to the linked page. Just shows a %23 in the URL, instead of the # sign.

Thanks anyway, Wiz

jdMorgan

4:00 pm on Nov 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, wrong tree. The problem is that named anchors are handled only within the brwoser -- all named anchor processing is done client-side. That is, if you click on a "link" on a page that points to a named anchor on that page then the browser can handle it. But you cannot "pass" a named anchor from the server to the client, because the browser won't handle it. :(

Jim