Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently using a rewrite rule to enable access to .php pages, without using the php extension. However to prevent old links from breaking, the pages can still be accessed via links containing the .php extension too.

For eg.

domain.com/page.php can now be accessed at domain.com/page

All the links on the website now use domain.com/page type links within the site. However older incoming links will still link to the .php pages, meaning Google will index both pages and mark them as duplicate.

I have two plans to remedy the situation.

  1. Use a php 301 redirect: When a page is accessed with the .php extension, I can redirect each page individually using a 301 redirect using php

  2. Using Canonical: Place a canonical tag on each page, pointing to the ".php" less version

My Question:
Are both methods equally efficacious in preventing Google from indexing my ".php" pages?
Which method should be preferred, by convention or otherwise?

share|improve this question
Wow, I wanted to ask the same questions, though I am having triples and quadruples – Gennady Vanin Геннадий Ванин Feb 2 '11 at 15:06

Doing both is exactly what you want to do and will be effective in preventing Google from finding duplicate URLs. The 301 redirect will make sure Google, and users, find the correct URL and the canonical URL will ensure Google knows the URL is the correct URL and to assign any reference to 'page.php' to 'page'.

share|improve this answer

In your case the Canonical tag is not important. The 301 is the strongest signal you can give that Google should update its index.

Canonical is more important if you can't or don't want to do a 301 Redirect.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.