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
    Regular Coder
    Join Date
    Jun 2010
    Posts
    296
    Thanks
    64
    Thanked 8 Times in 8 Posts

    How to rewrite without "XXX"?

    I've read the mod_rewrite sticky in this forum, and I have easily managed to perform the following rewrite:

    http://www.mydomain.com/index.php?page=somepage

    becomes in the browser:

    http://www.mydomain.com/page/somepage

    BUT, how can I rewrite to the original URL shown above from:

    http://www.mydomain.com/somepage

    i.e. without needing /page in the url to be rewritten?

    I have tried ^/(.*)$ ?page=$1 and various variations on that theme, but no joy.
    Last edited by XmisterIS; 08-29-2012 at 10:19 AM.

  • #2
    Regular Coder nomanic's Avatar
    Join Date
    Feb 2009
    Location
    United Kingdom
    Posts
    255
    Thanks
    9
    Thanked 33 Times in 33 Posts
    something like this would be better

    Code:
    RewriteRule ^(.*).html$ /index.php?page=$1 [QSA,L,NC]
    that way any html page called on the server would rewrite through your index.php page

    without the .html section EVERYTHING would rewrite through index, images, EVERYTHING
    <DmncAtrny> I will write on a huge cement block "BY ACCEPTING THIS BRICK THROUGH YOUR WINDOW, YOU ACCEPT IT AS IS AND AGREE TO MY DISCLAIMER OF ALL WARRANTIES, EXPRESS OR IMPLIED, AS WELL AS DISCLAIMERS OF ALL LIABILITY, DIRECT, INDIRECT, CONSEQUENTIAL OR INCIDENTAL, THAT MAY ARISE FROM THE INSTALLATION OF THIS BRICK INTO YOUR BUILDING."
    <DmncAtrny> And then hurl it through the window of a Sony officer
    <DmncAtrny> and run like hell

    Portfolio, Tutorials - http://www.nomanic.biz/

  • #3
    Regular Coder
    Join Date
    Jun 2010
    Posts
    296
    Thanks
    64
    Thanked 8 Times in 8 Posts
    I understand, thanks! I'll try it when I'm back in front on the PC and thank you when it works!


  •  

    Posting Permissions

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