Url Redirect any masters here?

Discussion in 'Apache' started by Angelina76, Oct 4, 2006.

  1. #1
    Hi
    Please Could anyone help me sort out my problem, I have read all the thread but still do not find how things work.
    I have website with dynamic urls like : http://www.domain.com/books.php?id=about&srch=12
    want to redirect them to
    http://www.domain.com/novels/

    I set a .htacess file with the following :
    --------------
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    RewriteCond %{QUERY_STRING} ^id\=([^&]+)\&srch\=([^&]+)$
    RewriteRule ^$ /novels/ [R=301,L]
    ---------------
    But when loading the page it is still the same
    Would appreciate your help
    Thanks
    Angelina
     
    Angelina76, Oct 4, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do you want to reDIRECT them or reWRITE them?
     
    T0PS3O, Oct 4, 2006 IP
    Nintendo likes this.
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^books.php?id\=([^.]+)\&srch\=([^.]+)$ http://www.domain.com/novels/ [R=301,L]

    For just a rewrite, you can't do

    RewriteRule ^novels/$ books.php?id=$1&srch=$2 [L]

    cause you can't give every single page the same URL. More like

    RewriteRule ^novels/id/([^.]+)/search/([^.]+)$ books.php?id=$1&srch=$2 [L]
     
    Nintendo, Oct 4, 2006 IP
  4. Angelina76

    Angelina76 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you for your prompt reply.
    I still unabel to fix it.
    In fact since i am going to change the structure of the website, i am looking on how to redirect all the dynamic Urls to the index page, so I can take advantage of the PR of the old Urls.
    So i would like to have ALL urls like :
    http://www.domain.com/books.php?id=about&srch=1
    http://www.domain.com/books.php?id=about&srch=2
    http://www.domain.com/books.php?id=about&srch=3
    ....
    have permanent redirection to
    http://www.domain.com/english/home.php

    thanks for your precious advice.
    Angelina
     
    Angelina76, Oct 4, 2006 IP
  5. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #5
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^books\.php?id\=(.*)\&srch\=(.*)$ http://www.domain.com/english/home.php [R=301,L]

    If that doesn't do it, I don't know what will. Dynamic redirects arn't very friendly.
     
    Nintendo, Oct 4, 2006 IP
  6. Angelina76

    Angelina76 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi Nintendo
    The point is to make a SEO friendly move, so what would you suggest in order to take advantage of the old Urls PR?
    Thanks for your patience
    Angelina
     
    Angelina76, Oct 4, 2006 IP
  7. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #7
    If the pages are already indexed, changing the URLs is the LAST thing to do. You're supposed to change them BEFORE the search engines find them.
     
    Nintendo, Oct 5, 2006 IP
    T0PS3O likes this.
  8. Angelina76

    Angelina76 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    HI again
    I tried to add this code my .htaccess file but unfortunately the urls are still teh same :confused:

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^books\.php?id\=(.*)\&srch\=(.*)$ http://www.domain.com/english/home.php [R=301,L]
    
    Code (markup):
    Regards
    Angelina
     
    Angelina76, Oct 5, 2006 IP
  9. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #9
    Just as I guessed. It's hopeless. Apache doesn't like redirecting dynamic URLs very well. You're toast. Next time you make a site, change the URLs FIRST, not after you got the site indexed in search engines and have PR.
     
    Nintendo, Oct 5, 2006 IP
  10. Angelina76

    Angelina76 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    This will teach me how to think well before building any new website in the future.
    thanks for your patience ;)
    Angelina
     
    Angelina76, Oct 5, 2006 IP