PDA

View Full Version : Redirect Dynamic URLs to staic



marglez
27 Dec 2010, 08:06 AM
Hi ,

I worked recently the rewrite rules in the htaccess to create SEO friendly urls. However the dynamic urls are still accessible, so now for one page I have 3 urls, which is bad for SEO.

for example

URL A - http://www.domain.com/details.php?title=yellow-book&itemID=78
URL B- http://www.domain.com/details.php?itemID=78
URL C - http://www.domain.com/yellow-book-78.html

this three urls are presenting the same content:

I was able to setup rule in the htaccess to redirect URL B to URL C
using the following rule:

RewriteCond %{QUERY_STRING} ^itemID=78$
RewriteRule ^details\.php$ http://www.domain.com/yellow-book-78.html? [R=301,L]

and that is working fine, and probably redirecting from A to C is a similar process.

However using this approach I would have to write a rule for every single detail page on the website! and there are a lot of URLs.

Can this be done on a single statement instead of doing one rule per Dynamic URL?