mod_rewrite - partially works

Discussion in 'Apache' started by wmg, Jan 24, 2006.

  1. #1
    I have a problem rewriting urls and cannot find where i'm wrong.
    The needed module in Apache is activated
    The server can read the .htacces file

    The .htaccess contain the following :
    RewriteEngine on
    Options +FollowSymLinks
    RewriteRule event-(.*)\.htm$ /events/search.php?name=$1


    I want to change the dynamic url
    www.mysite.com/events/search.php?name=test
    TO
    www.mysite.com/event-test.htm

    Partially works!
    If i type the htm page directly in the browser all it's ok..i find my page,
    but here is the problem :
    doesn't apache must rename all links matching the rule in dynamics pages (e. www.mysite.com/events/index.php) ?
    Maybe i need to add some php script to generate this static urls ?

    Thanks for help !
     
    wmg, Jan 24, 2006 IP
  2. wmg

    wmg Guest

    Messages:
    22
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Ok, i have to change my dynamic url in the php page to call new urls...
    The variables doesn't change ... only the url type ...
    so in index.php when i have a call like :
    search.php&name=$test
    will become
    event-$test.htm

    Ok ok ...
    so stupid auto-answered question ... :) :eek:
    Maybe can help someone...
     
    wmg, Jan 24, 2006 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    Apache doesn't change URLs, only makes the fake URLs work. That's why you had to change the links in the script. A .htaccess file can't edit a script!! If you try to redirect from dynamic to static using .htaccess, you get a forever loop... no old URL, no new URL, no old....
     
    Nintendo, Jan 24, 2006 IP