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 5 of 5
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts

    no literal "?" in mod_rewrite regex? Or what's up?

    I'm using mod_rewrite to do "clean URLs", so a URL like "/site/portfolio/projects/" is rewritten into "?c=portfolio&s=projects".

    So I've written this rule:
    Code:
    RewriteRule ^site/([a-z]+)[/]?([a-z]+)?[/]?([a-zA-Z=&]+)? /?c=$1&s=$2&$3
    It's open ended so that something like "/site/portfolio/projects/foo=bar" can become "?c=portfolio&s=projects&foo=bar"

    But that only works with manually generated URLs that don't have the "?" - I want to be able to use transient SID, and GET method forms, so it's gonna need to handle stuff like "/site/portfolio/projects/?foo=bar".

    Okay ... so surely that's simply a case of adding a literal question mark into the expression:
    Code:
    ^site/([a-z]+)[/]?([a-z]+)?[/]?[\?]?([a-zA-Z=&]+)?
    But it doesn't work - everything after the "?" is lost. How come? Can I not have a literal question mark, or what's up?
    Last edited by brothercake; 09-01-2003 at 08:48 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    use the ascii code or html entitly for it.

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How do I do that - would "&#15" not be those four characters individually?
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    a ? mark is & # 6 3 ;
    without the spaces!

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cool, I thought it was 15 .. but either way - how do I use that in a mod_rewrite regex? - an expression like

    [?]

    matches any one character out of "&", "#", "6", "3" or ";"

    btw - you can do entities in the forum if you go ?
    Last edited by brothercake; 09-02-2003 at 01:30 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

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