Hacker News new | ask | show | jobs
by tjarratt 5486 days ago
This is my number one pet peeve, right here:

>>>>>>>>>>>>>>

# Force all clients that hit this host to www.nintendo.com

RewriteEngine on

RewriteRule .* http://www.nintendo.com/ [R,L]

<<<<<<<<<<<<<<

Nothing is worse than trying to go to foobar.com/something/I/know/exists and being redirected back to the homepage. What's wrong with deep linking and respecting URLs that a user has been to before?

More importantly, doesn't this interfere with bookmarks?

2 comments

Uh, it doesn't mean that at all. Here's a random link, note how it doesn't redirect to the homepage: http://www.nintendo.com/games/detail/9xKcFNixgDWMPXx0DGu0_77...

That's just the default behavior. There's an enormous amount of other rewrites to handle actual functionality.

Bookmark interfering - probably. But which is worse for most users: a 302 / 404 error, or being pushed somewhere useful to start from?

302 won't break bookmarks.

Most users get taken to where they meant to go, without noticing the domain rewrite.

That line just handles people who managed to hit the server from a domain they're not expecting at all - for example if I were to map example.org to their server in /etc/hosts.

The pertinent lines for your example are 341 and 342:

  RewriteCond %{HTTP_HOST} =nintendo.com [NC]
  RewriteRule ^/(.*) http://www.nintendo.com/$1  [QSA]