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 to the CF scene
    Join Date
    Nov 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help needed with RewriteRule

    hey guys,
    the rule below currently rewrites a URL such as:
    "mydomain.com/profile/pictures.php?profile=BLAH&imageid=999&page=11"
    to:
    "mydomain.com/BLAH/pictures/999/11/"
    Code:
    RewriteRule ^([^/]+)/pictures/([^/]+)/([^/]+)/?$ profile/pictures.php?profile=$1&imageid=$2&page=$3 [NC,QSA,L]
    ..but i need this rule to also work even if the "imageid" and "page" variables are not set; so i can use URLs such as:
    "mydomain.com/BLAH/pictures/999/"
    and:
    "mydomain.com/BLAH/pictures/"
    can anyone please suggest how my RewriteRule needs to be changed for it to work with the above URLs?- or would it be a matter of writing an additional two rules for URLs without those variables set?

    hope ive explained myself well, thanks for any help
    Last edited by jacko310592; 08-19-2010 at 01:47 AM.

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    As far as my understanding goes, you will need to have two additional rewrite rules for those. I'd suggest putting them under the other two and making each line a 'last' match as otherwise you might run into problems.

    You can make a line last by adding the [L] flag at the end of it.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?

  • #3
    New to the CF scene
    Join Date
    Nov 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks Eldarrion, i'll do that then (:


  •  

    Tags for this Thread

    Posting Permissions

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