Really need help with redirecting(301) old dynamic urls

Discussion in 'Apache' started by golb12, Mar 27, 2009.

  1. #1
    Hi,

    I am running a linux server(vsd godaddy) with apache and my content management system is joomla. Recently I implemented url rewriting using core joomla rewrite code to get rid of the dynamic urls the joomla created, and everything went fine. ( I changed all outdated urls etc).


    BUT now I cant (worked on this 10 hours so far) get the old dynamic urls to redirect to the new clean URLS.

    I have tried modrewrite, but my skills with modwrite are poor and I could not get it to work. I kept getting either internal 500 errors or 404 non found errors


    Then I tried using simple strategies like
    Redirect 301
    Redirect permanent


    Again either it would not redirect or I would get 500/404 errors.

    I am new to apache but I am aware of errors such as trailing /, I don't think this is the case.

    Neither are working to redirect my dynamic urls, I assume because something to do with modrewrite I have already implemented because redirecting old HTML pages still works.


    If someone can help me or tell me how to get google to drop old urls this would be a huge help.


    Thanks.
     
    golb12, Mar 27, 2009 IP
  2. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Anytime you redirect to a rewrite, you will create an internal loop.

    You need to:
    a) Add a parameter to your rewrites that is a unique key or
    b) Use {THE_REQUEST}

    Take care.
     
    Lpe04, Mar 29, 2009 IP
  3. golb12

    golb12 Peon

    Messages:
    132
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    oh nevermind ill look more.
     
    golb12, Mar 29, 2009 IP
  4. Lpe04

    Lpe04 Peon

    Messages:
    579
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #4
    well, if you are interested, what you need to do is,

    RewriteCond %{QUERY_STRING} ^somestring=([a-zA-Z0-9]+)$
    RewriteRule ^index.php newfolder/%1? [R=301,L]
    
    RewriteRule ^newfolder/(.*) index.php?somestring=$1[B]&extra=1[/B] [L]
    Code (markup):
     
    Lpe04, Mar 29, 2009 IP