.htaccess url rewriting when special character (&, #) presented in value

Discussion in 'Apache' started by KingCobra, Jul 31, 2012.

  1. #1
    I want to use user friendly url instead fo dynamic url using .htaccess
    But I am facing a problem because in the url I have value including special character (& and #).
    Example: Account & Administration, C # Programming

    So how can i rewrite them?

    Here is my current dynamic url:
    http://www.domain.com/result.php?subject=Account & Administration
    http://www.domain.com/result.php?subject=C # Programming

    I like to use these friendly url:
    http://www.domain.com/skills/Account+&+Administration OR http://www.domain.com/skills/Account-&-Administration
    http://www.domain.com/skills/C+#+Programming OR http://www.domain.com/skills/C-#-Programming


    Currently I am using this .htaccess
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^skills/([^_]*)$ result.php?subject=$1 [L]

    It works except when there is a '&' or '#' sign included with the value.
    When value contain '&' sign then it take first part of the value only like bellow;
    http://www.domain.com/skills/Account

    PlEASE HELP ME
     
    KingCobra, Jul 31, 2012 IP
  2. KingCobra

    KingCobra Well-Known Member

    Messages:
    289
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #2
    No solution for it !!!!!
    Feeling so sorry....
     
    KingCobra, Aug 1, 2012 IP
  3. Virtix

    Virtix Active Member

    Messages:
    82
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    You can use this with WP what panel you use?

    Thanks
     
    Virtix, Aug 6, 2012 IP