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
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts

    URL masking with page parameters

    Hi,

    I have a site that contains info.php that takes a page parameter and includes another file as defined in an array.

    The possible urls are:

    Code:
    info.php?page=1 - pulls in aboutus.php
    info.php?page=2 - pulls in contactus.php
    I'm trying to us mod_rewrite to give me the following urls:
    Code:
    http://www.mysite.com/info/aboutus
    http://www.mysite.com/info/contactus
    I've half got it working with:
    Code:
    RewriteRule ^page/([^/\.]+)/?$ info.php?page=$1 [L]
    this gives:
    Code:
    http://www.mysite.com/page/1
    also for some reason my relative paths are messed up - its looking in page/image and page/css instead of root/images root/css

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    I expected the following to work, but it didn't

    htaccess
    Code:
    RewriteRule ^info/([^/\.]+)/?$ info.php?page=$1 [L]
    expected url
    Code:
    http://www.mysite.com/info/1
    Just got a 500 internal error.

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Getting there...

    The above didn't work because I have a rewrite so .php isn't needed in the url.
    I renamed info.php to information.php and used info in the url.

    Code:
    RewriteRule ^info1/([^/\.]+)/?$ info.php?page=$1 [L]
    I'm still having problems with the base url. I've tried RewriteBase / just before the above RewriteRule but no joy.


  •  

    Posting Permissions

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