Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

htaccess url rewriting wrecking my head

Options
  • 17-02-2015 11:19pm
    #1
    Registered Users Posts: 1,551 ✭✭✭


    I can't get my head around url rewriting.
    I've done regular expressions before but I still can't figure out what hell is going on.
    Anyway my addresses are in the form eg. on the about page
    /index?page=about
    and I'd like it to go to the same page if I type
    /about
    How do I go about doing that?


Comments

  • Registered Users Posts: 6,508 ✭✭✭daymobrew


    RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L]
    
    Found it in a site I was working on recently.

    It will sent /about to /index.php?page=about


  • Registered Users Posts: 1,551 ✭✭✭quinnd6


    It's great thanks I figured out what I was doing wrong with your solution.
    I just had to make a slight change to it and it worked for me.
    It was bringing me back to www so just added a ./ and it worked.
    RewriteRule ^([^/\.]+)/?$ ./index.php?page=$1 [L]

    Thanks a million for the help.


Advertisement