Quick mod_rewrtie quesyion

Discussion in 'Coding Help' started by ziycon, Feb 25, 2008.

  1. Joseph Grogan

    Joseph Grogan New Member

    Hi i tried that mod rewrite to and it dont seem to be working for me either. It just leaves it as it was. Didnt change the name at all
     
  2. Forbairt

    Forbairt Portfolio Building

    I'd recommend xampp / wampserver .. (using wamp server cus its what I've used for ages ... if I was to do it again I'd probably move to xampp as there are a few extra nice things bundled with it)
     
  3. davidbehan

    davidbehan New Member

    Sorry, after looking again at it, you're right. I was thinking [R=301] for some reason. It was late when I was replying! :D
     
  4. ziycon

    ziycon New Member

    I have the .htaccess file in the root folder of the webserver htdocs and i have the load module for mod_rewrite enabled but still wont reslove any of the address i type in!?
     
  5. CiaranR

    CiaranR Weeno Ltd + Skimlinks.com

    You should have the .htaccess file in html root folder of the site you are developing not your localhost root (i.e. beside your index.php)

    what kind of error are you getting? did you restart apache after enabling the mod rewrite module?
     
  6. ziycon

    ziycon New Member

    It just gives me a 404 error! So confused!
     
  7. ziycon

    ziycon New Member

    Fixed it! :D

    There was a line i had to change from:
    to:
    Working perfectly now!
     
  8. CiaranR

    CiaranR Weeno Ltd + Skimlinks.com

    Ah cool that explains the 404 :D
     
  9. ziycon

    ziycon New Member

    Another small query!:D

    I want it to show the page number and the search type in a linkl, is there a better more efficient way to do this?

    releases/1-all.htm
    releases/2-some.htm

    Where '1' is the $1 var and 'all' is the $2 var in the below rewrite rule:

    RewriteRule ^releases/([0-9]+)-([^/]*)\.htm$ /releases.php?page=$1&stype=$2 [L,NC]
     
  10. louie

    louie New Member

    I don't get it. Is that way not working for you?
     
  11. ziycon

    ziycon New Member

    It is working but im trying to get it to work with AJAX, i have a page and i want the link to show up say as /releases.htm but to have two variables in the 'real' link to say what page to go to and what sort order like, show only ones starting with a or show all results.

    The orginal url is /releases.php?page=1&stype=a but im not sure if i mod_rewrite the url too /releases.php will the ajax script pick up on the different variables and populate the page properly?

    Its just im unsure if the mod_rewite has to have the variable in the new url!
     
  12. ziycon

    ziycon New Member

  13. louie

    louie New Member

    the ajax call has to go to the server and bring you back the responseText so the RewriteRule will work if properly formated.
    If you don't want to add the url to the onclick you can create eventListener for the respective link itself.
     

Share This Page