.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.

Помог ли вам данный ответ?

 Распечатать статью

Также читают

a line in my crontab

Posted by cannibal, 01-13-2008, 05:50 AMhello I found this line in my crontab file 0...

javascript dies in php

Posted by ti_nhatrang, 01-17-2008, 06:49 AMHi guys, I can't seem to put this in a echo...

order and login issues

Posted by zomby, 03-21-2007, 11:40 PMHi everyone, I have installed plesk as control panel for...

WHM to point site to home server

Posted by kiwami, 05-04-2007, 12:19 PMwhats up fellers, i'm attempting to point my design site...

Loading proress bar before iframe

Posted by bambinou, 11-16-2012, 11:39 AMHello, I have an hotel booking affiliate iframe that...