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

Bu cevap yeterince yardımcı oldu mu?

 Bu dökümanı yazdır

Also Read

SQL DB backup error !

Posted by htw_Mehdi, 09-14-2007, 09:28 PMhello, when i try to backup mysql database on the...

grsec WARNING: No module mptscsi found for kernel 2.6.22.9-grsec, continuing anyway

Posted by uploadalerts, 03-27-2008, 04:46 PMHi, I see the following error, while trying to...

Email issue

Posted by manindarkjp, 03-30-2008, 08:31 AMHello, I have a dedicate server and got a problem...

.htaccess & cpanel

Posted by compjab, 03-24-2007, 11:22 PMI've protected a directory with cPanel and the user/pwd...

FreeBSD CPUs

Posted by BostonGuru, 03-23-2007, 12:51 AMDoes anyone know how to bind a process (either when...