.htaccess problem

Posted by londonhogfan, 09-23-2008, 02:05 AM
hi, I'm having quite a problem with my site on google. I rushed into things and have had to restructure the site so now I have a lot of missing pages on google. I am trying to forward all the bad pages to the correct ones, but there are a few hundred. Is there an easier way than doing what I'm doing? Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/CoachDetails.php?coach=15 mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/CoachDetails.php?coach=23 mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/CoachDetails.php?coach=24 mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/CoachDetails.php?coach=25 mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/CoachDetails.php?coach=29 mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/CoachingResults.php mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/GameSearch.php mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/Opponents.php mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/Players.php mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/Polls.php mydomaincom/coaching-records/1/John-Clinton-Futrall/ Redirect 301 /db/coaching-results/1/John-Clinton-Futrall/YearlyResults.php mydomaincom/coaching-records/1/John-Clinton-Futrall/ basically I had some links coming after "John-Clinton-Futrall" on the template and it has added it for many, many pages. I need to change all directories from "coaching-results" to "coaching-records" and then remove anything coming after the "/" following "Futrall" Thanks for any help.

Posted by Jatinder, 09-23-2008, 02:43 AM
Try this:

Posted by londonhogfan, 09-23-2008, 09:25 AM
thanks for this. does this do a 301 redirect? Is it possible to make it work where the "1" and "john-clinton-Futrall" changes. example... there is a /3/different-name/, /4/another-name/, etc so anytime the site has db/coaching-results/#/aaa-bbb-ccc/~ it should redirect to db/coaching-records/#/aaa-bbb/ccc/ Thanks for your time.

Posted by foobic, 09-23-2008, 07:27 PM
It would be a 302 by default. Here's a tweaked version:

Posted by londonhogfan, 09-23-2008, 08:19 PM
thats working much better. My only problem now is that is still leaves the "?coach=15" or anything after ".php" thanks for helping me out on this.

Posted by foobic, 09-23-2008, 08:34 PM
No problem. A final ? should clear the query string:

Posted by londonhogfan, 09-23-2008, 09:03 PM
perfect! Thanks again.

Posted by mod_webhosting, 09-24-2008, 07:13 AM
Because of the how regular expression works, more efficient way would be: Both RewriteRules do the same redirection. Benchmark: 10000 foobic's regular expression matchings: 0.117690086365 seconds 10000 my regular expression matchings: 0.0283961296082 seconds You'll be fine with either one you choose and you'll notice no speed difference. I'm just pointing out that efficiency should also be kept in mind while programming.

Răspunsul a fost util?

 Tipărire

V-ar mai putea interesa și

Free script that hides links?

Posted by bambinou, 11-12-2012, 04:29 AMHello, I would like to know if you have ever seen a...

Soap question

Posted by paintball12k, 09-21-2008, 04:41 AMDoes anyone know where I can find good articles on...

what could be the problem ?

Posted by jjk2, 06-26-2008, 03:13 AMi am experiencing some strange thing. i have to reload a page...

Alabanza Alternative?

Posted by AaronBrown, 09-29-2001, 10:45 AMI have heard bad things about alabanza, and i was...

mySQL Caching

Posted by jweeb, 03-10-2010, 10:54 PMHi All, I am new to this. I would like to do a mySQL...