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

Hjalp dette svar dig?

 Print denne artikel

Læs også

Netacore Support Links Broken?

Posted by kjedwards, 09-05-2002, 04:19 AMHi Can anyone tell me how to access Netacore support...

When blog works forums stops working and viceversa

Posted by sash_007, 03-10-2010, 08:47 PMHello friends, I am having a weird problem my problem is...

Free host sites.

Posted by abbas, 09-17-2001, 06:01 AMHi. I want to start a free host site similar to...

Set up file that will be called up in cron

Posted by ninak, 03-09-2010, 10:10 AMI am kind of embarrassed asking this question but I hope...

Drop-down header (yahoo like?)

Posted by coume, 03-13-2010, 07:40 AMHello, I struggled to find the right title for the thread...