Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2010
    Posts
    29
    Thanks
    0
    Thanked 2 Times in 2 Posts

    lose extension, keep query

    On my website, I am using redirects to change addresses like
    http://example.com/about to
    http://example.com/?page=about

    I have this code:

    Code:
    RewriteEngine on
    RewriteRule ^([a-zA-Z0-9]+)$ ./?page=$1
    Which works great. Until you have an address like this:
    http//example.com/about?name=bob

    The query is completely lost. How can I do the redirect and keep the query? So
    http://example.com/about?name=bob becomes
    http://example.com/?page=about&name=bob

    Thanks.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Code:
    RewriteEngine on
    RewriteRule ^([a-zA-Z0-9]+)$ ./?page=$1 [L,QSA]

  • #3
    New Coder
    Join Date
    Oct 2010
    Posts
    29
    Thanks
    0
    Thanked 2 Times in 2 Posts
    . . . I feel like a moron now that I know the solution was so simple, lol.

    But thank you very much for the help!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •