Forum Moderators: phranque

Message Too Old, No Replies

Rewriting posting-URLs to topic-URLs

         

Mark26

12:17 am on Jul 12, 2011 (gmt 0)

10+ Year Member



Google indexed many posting-URLs with this structure: www.domain.tld/some-topic-t123.html#p456 - I already stopped that by adding Disallow: /*#p* to my robots.txt - but I want those senseless posting-URLs 301 rewritten to the topic-URLs -> www.domain.tld/some-topic-t123.html. I don't know how to do that with mod_rewrite.

Your help is very much appreciated!

g1smd

7:31 am on Jul 12, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Google does show "jump to" links within the snippet using that format, and that is not generally a problem.

Are you saying they indexed the format as #p456 for the main URL for the page? That would be something new if it is the format for the URL shown as the major link in the SERPs and would be a major problem for a lot of sites.

You cannot redirect #fragment URLs as the # request is not sent to the server. It is resolved only within the browser.

By the way, /*#p* is incorrect syntax, you need only /*#p as robots.txt pattern matching is a "begins with" match.

lucy24

8:41 am on Jul 12, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You cannot redirect #fragment URLs as the # request is not sent to the server. It is resolved only within the browser.

It does show up in the referer; that's how it gets into your logs. Could you do some kind of fancy footwork with alternative anchorless pages?

g1smd

9:45 am on Jul 12, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Only Safari sends #fragments as far as I know.

I see that as a bug. :-)

lucy24

7:31 pm on Jul 12, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Only Safari sends #fragments as far as I know.

I see that as a bug. :-)

You mean from the user end? Bummer. I've only found a couple of them in logs, but the one I noticed was an absolute textbook example of a good use of # because it kept the user from having to either browser-search or scroll down a long page. (Or, in this case, select an item from the TOC list at the very beginning, so I guess it's not that much of a hardship anyway.)

On my computer it works on Safari and Camino (but not Firefox). Not in Chrome, hahaha. And now my logs will show me five different user-agents that are all me. This is useful information in its own right ;)