You are here: Redirect with .htaccess « PHP Programming Language « IT news, forums, messages
Redirect with .htaccess

Posted by mobile_1 on 11/28/06 19:30

I am trying to fix a problem where Google has indexed the wrong version of a
URL. I need to redirect the bad version to the good version with 301
redirects.

I've tried a couple of things, but it's not working.

The bad URLs look like this:
/search.php?mode=search&narrow_cat=2&term=World,%20Hello&page=1

That should redirect to:
/dir/Hello_World

This one doesn't work at all:
RewriteRule
^search\.php\?mode=search&narrow_cat=[0-9]{1,2}&term=([A-Z]{1}[a-z]+),%20([A-Z]{1}[a-z]+)&page=1$
http://www.example.com/dir/$2_$1 [R=301,NC,L]


This one works, except it doesn't include the "Hello" and the "World", only
the underscore:

RewriteCond %{QUERY_STRING}
mode=search&narrow_cat=[0-9]{1,2}&term=([A-Z]{1}[a-z]+),%20([A-Z]{1}[a-z]+)&page=1$
RewriteRule ^search\.php http://www.example.com/dir/$2_$1 [R=301,NC,L]

Any ideas?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация