301 redirect for certian php urls

Discussion in 'PHP' started by mrrfid, Mar 4, 2010.

  1. #1
    I have what should be a simple problem that is driving me crazy. I am migrating to a new server on a new domain. I don't want to loose my page ranking for certain pages and have created a list of the old site URLs & the new site URLs. I should be able to change my .htaccess file with 301 redirects but I cannot seem to get the correct syntax. Here's what I need:

    Old URL -> http://rfidwizards.com/index.php?option=com_chronocontact&chronoformname=Request_Help
    Should now have a 301 redirect to new URL -> http://www.rfid.net/confidential-contact-us

    That's it! Nothing tricky, no wild cards. Just a simple list of about 20 pages just like the above. Can anyone please help?
     
    mrrfid, Mar 4, 2010 IP
  2. mehmetm

    mehmetm Well-Known Member

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #2
    try googling man! it's so easy both googling and reaching for that info.

    http://www.google.com/search?hl=en&source=hp&q=htaccess+301+redirect&btnG=Google+Search&aq=f&aqi=&aql=&oq=
    Code (markup):
     
    mehmetm, Mar 4, 2010 IP
  3. Rockstr27

    Rockstr27 Well-Known Member

    Messages:
    1,052
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    115
    #3
    You would create a file called .htaccess on the server that holds your old domain with content like the following (you have to adjust to your domains/urls:

    RewriteEngine On
    Redirect 301 /oldpage/ http://www.newdomain.com/newpage/
    Redirect 301 /oldpage.php http://www.newdomain.com/newpage.php
    
    Code (markup):
    Good luck ...
     
    Rockstr27, Mar 4, 2010 IP
  4. mrrfid

    mrrfid Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi,
    Yes, I Googled and read about a dozen docs. I've tried many combinations of code and nothing is working properly. I've spent about 4 hours on what should be a 5 minute fix. Which is why I was hoping someone may be able to provide some insight. I'm beginning to think there is a config issue on my Apache server.
     
    mrrfid, Mar 4, 2010 IP
  5. ColorWP.com

    ColorWP.com Notable Member

    Messages:
    3,120
    Likes Received:
    100
    Best Answers:
    1
    Trophy Points:
    270
    #5
    Put those lines in your htaccess:
    Redirect http://oldurl.com/page.php http://newurl.com/new-page.html
    Code (markup):
    Repeat this line as many times as you need, replacing the appropriate old and new URLs.
     
    ColorWP.com, Mar 4, 2010 IP
  6. mrrfid

    mrrfid Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Rockstr,
    Thank you so much, but this was actually my first try and it simply ignores the statements. Here's my code (I wish it worked):

    RewriteEngine On
    Redirect 301 /index.php?option=com_chronocontact&chronoformname=Request_Help http://www.rfid.net/confidential-contact-us
     
    mrrfid, Mar 4, 2010 IP
  7. mehmetm

    mehmetm Well-Known Member

    Messages:
    134
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #7
    if you looked at google and couldn't fix your problem, then I'm sorry for my post :(

    however as I try to go to link above "http://rfidwizards.com/index.php?option=com_chronocontact&chronoformname=Request_Help"
    as far as I see it's still on its own page and has no 301 redirect.

    haven't you fixed your problem yet ?
     
    mehmetm, Mar 4, 2010 IP
  8. Rockstr27

    Rockstr27 Well-Known Member

    Messages:
    1,052
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    115
    #8
    @mrrfid - you are putting this on your old server, right? What you had should work ...
     
    Rockstr27, Mar 4, 2010 IP
  9. Rockstr27

    Rockstr27 Well-Known Member

    Messages:
    1,052
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    115
    #9
    @mrrfid - In other words, you have to maintain both servers, one with the old domain and one with the new, in order for this to work ... (does not have to be the same server, but you have to have hosting for both domains for this to work) ...
     
    Rockstr27, Mar 4, 2010 IP
  10. mrrfid

    mrrfid Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    So the closest code that has come to working is:

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/index.php?option=com_chronocontact&chronoformname=Request_Help [NC]
    RewriteRule (.*) http://www.rfid.net/confidential-contact-us [R=301,NC]

    Unfortunately, it redirects every page and sends the browser to http://www.rfid.net/confidential-contact-us?option=com_chronocontact&chronoformname=Request_Help

    Part of the first URL appended to the second URL, which of course doesn't exist.

    Ideas? I'm ready to hire someone to fix this.
     
    mrrfid, Mar 4, 2010 IP
  11. sunlcik

    sunlcik Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Let me try for a moment.
    Wait the good news.
     
    sunlcik, Mar 4, 2010 IP
  12. sunlcik

    sunlcik Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Wow:
    A perplexed question
    Pls try this code , hope it can help you. :)

    Oh,Can I have a cup of draft beer pls ,It is so hot at here!

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^option=com_chronocontact&chronoformname=Request_Help$ [NC]
    RewriteRule ^index.php$ http://www.rfid.net/confidential-contact-us? [R=301,L]
    PHP:
    Chrees
    Wu
     
    sunlcik, Mar 4, 2010 IP
  13. mrrfid

    mrrfid Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    You did it! That code worked first time. Wow!

    Where are you? Is it not hot here. I owe you a beer! Thank you!
     
    mrrfid, Mar 4, 2010 IP
  14. sunlcik

    sunlcik Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Lol...
    You are welcome.If you have any question,pls feel free contact me,my friend.
     
    sunlcik, Mar 4, 2010 IP