Search code examples
phpapachemod-rewriteurl-rewritingpermalinks

Get parameter variables in a permalink


I've a page that shows the last 10 articles of a database, and, with the $_GET['show-all'] variable, it shows all the articles.

Now, I want to use permalink. For the 'standard' page, the permalink is

/articles

for the second one, I might use this

/articles/show-all

But search engines as Google recognizes it as another page, and generated a duplicated meta-tag error. So I want to use this permalink instead

/articles/?show-all

But all my attempts didn't work. I tried this code in the .htaccess file:

RewriteRule ^articles/?(.*)$ /3/contents.php?p=articles&$1 [L]

or

RewriteRule ^articles/\?(.*)$ /3/contents.php?p=articles&$1 [L]    

Solution

  • Take a look at the canonical tag

    http://en.wikipedia.org/wiki/Canonical_link_element

    to avoid "duplicate content" ;)