views:

324

answers:

3

Take a very simple case as an example, say I have this URL:

http://www.example.com/65167.html

and I wish to serve that content under:

http://www.example.com/about

UPDATE: Note that the 'bad' URL is the canonical one (it's produced by a CMS which uses it internally for linking), so "/about" is just a way of polishing it.

I have two broad options: a server-side redirect or a client-side one. I always thought that server-side would be preferable since it's more efficient, i.e. HTTP traffic is approximately halved. However, SEO techniques tend to favour a single URL for a resource, thus client-side is to be preferred.

How do you resolve this conflict, and are there other factors I've omitted?

+3  A: 

Apache HTTPD's mod_rewrite can leave a browser showing a SEO-friendly URL in its location bar while redirecting to a numeric URL on the server:

RewriteEngine on
RewriteRule ^/about$ /65167.html [L]
Ignacio Vazquez-Abrams
While that's an option, it doesn't solve the problem: two URLs still exist for the same resource. In fact, the horrible nasty one is the canonical one (I'll update the question to mention that), so I don't think this fix is what I'm looking for.
Bobby Jack
You could use another redirect rule to ‘hide’ the 65157.html URL from incoming requests. Using remapping on the server side, a search engine has no way to know what is ‘canonical’ anyway, so if you don't link to the ‘ugly’ URL they probably won't pick it up.
bobince
Unfortunately, as per my question-edit, the CMS that generates these URLs also generates links to them, so they will remain public.
Bobby Jack
Urgh! In that case you would have to make the ‘(id).html’ 301 to the ‘about’, then mod_rewrite the ‘about’ back to the ‘(id).html’. And yes, that would involve an unnecessary HTTP request for each page, and might slow down Googlejuice propagation. Better plan: fix the CMS to link to the right URL.
bobince
+2  A: 

I'm pretty sure Google understands 301 Moved Permanently.

Hank Gay
+2  A: 

A 301 is the wrong approach for this problem if you're redirecting from /about to /65167.html. Your CMS will only understand the 65167.html request but a 301 is basically telling Google that /about no longer exists and to index the 65167.html page.

Ignacio is correct. You need to implement either mod_rewrite or something similar depending on your platform and hide the CMS assuming that you can actually re-write all your CMS generated links to something more friendly.

A client side redirect is probably too complex to implement and a server side redirect will cause two requests to the server.

Michael Glenn
You are right Michael. I don't know what I was thinking. I'll remove my stupid answer.
allesklar