Need 301 Help - about 10 URLs but different content IDs

Discussion in 'Apache' started by GeorgeB., Nov 19, 2006.

  1. #1
    OK I just converted my board from IPB to vbulletin.

    I have the following URLs that I need to redirect to the new vb URLs since they are specific team forums and have a lot of backlinks.

    OLD: http://www.hoopstalk.net/index.php?showforum=4
    NEW: http://www.hoopstalk.net/forumdisplay.php?f=263

    OLD: http://www.hoopstalk.net/index.php?showforum=5
    NEW: http://www.hoopstalk.net/forumdisplay.php?f=264

    OLD: http://www.hoopstalk.net/index.php?showforum=6
    NEW: http://www.hoopstalk.net/forumdisplay.php?f=265

    OLD: http://www.hoopstalk.net/index.php?showforum=7
    NEW: http://www.hoopstalk.net/forumdisplay.php?f=266

    OLD: http://www.hoopstalk.net/index.php?showforum=8
    NEW: http://www.hoopstalk.net/forumdisplay.php?f=267

    I definitely want them all to be 301 redirects not just rewrites

    How do I do this?
     
    GeorgeB., Nov 19, 2006 IP
  2. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #2
    use the following:

     
    redirect 301 /index.php?showforum=6 http://www.hoopstalk.net/forumdisplay.php?f=265
    redirect 301 /index.php?showforum=x http://www.hoopstalk.net/forumdisplay.php?f=x
    redirect 301 /index.php?showforum=x http://www.hoopstalk.net/forumdisplay.php?f=x
    
    Code (markup):
    just use a new line for each one, put that in an htaccess. that's the easiest way to go about it.
     
    disgust, Nov 19, 2006 IP
  3. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Yeah for some reason it ignores that. (redirect 301)

    I know 301 redirects with rewrtie works.. but not that.
     
    GeorgeB., Nov 19, 2006 IP
  4. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #4
    that should work just fine. something's odd with your configuration.

    what code DID work in htaccess?

    it looks like your htaccess may be disabled, or you're placing it in the wrong directory, or something. the code above is fine.
     
    disgust, Nov 19, 2006 IP
  5. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #5
    Nah stuff like this works fine

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^([0-9]+)/(.*).html$ index.php?act=single&q=$1
    RewriteRule ^([0-9]+)/$ index.php?page=$1
    RewriteRule ^index.html$ index.php
    RewriteRule ^ads.js$ ads.php
    RewriteRule ^adsrectangle.js$ adsrectangle.php
    RewriteRule ^feed.xml$ feed.php
    RewriteRule ^submit-riddles.html$ index.php?act=submit
    RewriteRule ^search-riddles.html$ index.php?act=single
    RewriteCond %{HTTP_HOST} ^onlyriddles.com [NC]
    RewriteRule ^(.*)$ http://www.onlyriddles.com/$1 [L,R=301]
     
    GeorgeB., Nov 19, 2006 IP
  6. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #6
    you still should be able to get the above code to work, that's really odd. is the htaccess file you're placing it in empty? try putting the code first in the file.

    if that still doesn't work, you can always do it with RewriteRules I suppose... kinda overkill for something like this though
     
    disgust, Nov 19, 2006 IP
  7. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #7
    When I used the code you suggested .htaccess was empty.

    How would I do it with rewriterules?
     
    GeorgeB., Nov 19, 2006 IP
  8. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #8
    I found out it's because of the question mark in the source URL

    index.php?showforum=4

    If I take that out it works perfectly. With it in it ignores it.

    Anyone know how to I guess "escape" the question mark symbol ? in .htaccess?
     
    GeorgeB., Nov 19, 2006 IP
  9. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #9
    redirect doesn't use pattern recognize, it's for identical matches.

    you'd need RedirectMatch. that uses regex syntax. you use \ to escape things in regex.

    you could try it in the plain redirect but I have idea if it'd work. guessing it wouldn't.
     
    disgust, Nov 20, 2006 IP