Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

htaccess url rewriting wrecking my head

  • 17-02-2015 10:19PM
    #1
    Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭


    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, Registered Users 2 Posts: 6,683 ✭✭✭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, Registered Users 2 Posts: 1,559 ✭✭✭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