.htaccess redirect problem

This is a discussion on ".htaccess redirect problem" within the PHP Forum section. This forum, and the thread ".htaccess redirect problem are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 21st, 2007, 06:34
Junior Member
Join Date: Dec 2005
Location: Vilnius, Lithuania
Age: 36
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
.htaccess redirect problem

Sorry, not sure if this is an appropriate forum for my enquiry. But just haven't found siutable category. Here is the problem:
I redirect a big number of files with 301 redirect in .htaccess file.
The redirect line for each file looks like this:
Code: Select all
redirect 301 /old/old.php?id=1 http://www.mysite.com/new.php?id=1
but it redirects me to
Code: Select all
http://www.mysite.com/new.phpold.php?id=1
What should I do? I'm having dozens of highly ranked pages... Need to save my positions. Please help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 22nd, 2007, 02:18
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: .htaccess redirect problem

I'm no expert on this, but do any of these help?

http://www.google.com/search?q=.htac...ing%20redirect
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 22nd, 2007, 07:03
Junior Member
Join Date: Dec 2005
Location: Vilnius, Lithuania
Age: 36
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Re: .htaccess redirect problem

Quote:
Originally Posted by Ryan Fait View Post
I'm no expert on this, but do any of these help?

http://www.google.com/search?q=.htac...ing%20redirect
Thank you Ryan. I didn't think of formulating my google query this way. The solution though was found yesterday and it appears to be very simple. I tryed to remove my redirect rules one after another. So that if originally I had:
redirect 301 /old/ http://www.mysite.com/new.php
redirect 301 /old/old.php?id=1 http://www.mysite.com/new.php?id=1
redirect 301 /old/old.php?id=2 http://www.mysite.com/new.php?id=2
redirect 301 /old/old.php?id=3 http://www.mysite.com/new.php?id=3

and it worked correctly for the base url only (1st redirect)

Now I have simply removed anything after the first line - and it workes fine for all the dynamic urls based on www.mysite.com/new.php

It really troubled me I should admit. Quite a bit of work has been done to achieve our current positions in SERPs and I didn't want to roll back to the old design/structure either.

The other possible question out of this is how to make a rewrite rules with mod_rewrite for the new urls having redirects from the old (non-exsisting) ones. Or in other words:
Task #1 to redirect http requests from the old urls to new ones (accomplished)
Task #2 to make new urls SE friendly (give them a static look)
Would it be ok just to add rewrite rules after 301 redirect rules into the same .htaccess file?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 22nd, 2007, 07:48
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: .htaccess redirect problem

I'm going to bow out on this one, I only use static pages. Sorry!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
301 redirect, htaccess

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
301 redirect and .htaccess Help dts0099 Search Engine Optimization (SEO) 2 Oct 26th, 2007 21:48
.htaccess rewrite problem benbigun PHP Forum 4 Nov 13th, 2005 01:08


All times are GMT. The time now is 22:09.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42