mod_rewrite hyphens spaces and more problems

Discussion in 'Apache' started by epsavit, Nov 10, 2011.

  1. #1
    hi everybody
    i would like some help if its possible

    the problem is i have an old url like this
    activities.php?lang=bg&page=full category- name&com=comname
    which i read through the query string like this

    RewriteCond %{QUERY_STRING} lang=(.*)&page=(.*)&com=([a-z]+)$

    and then with a rewrite rule i turn it into a simple url like this

    RewriteRule activities.php?$ "/foldername/activities/%1/0/0/%2/%3\.html?" [R=302,L]

    and the end result is
    The requested URL /activities/bg/0/0/%20name/comname.html was not found on this server.
    so from page=full category- name i get only the last part > name

    the problem is the spaces and hyphen on the "page=full category- name"
    so i changed the query string reference like
    RewriteCond %{QUERY_STRING} lang=(.*)&page=([a-z- ]+)&com=(.*)$ in order to include the spaces and hyphens.
    but that change produces Internal Server Error.
    the variable named page sometimes contains spaces and sometimes it doesnt.
    can someone tell me what am i doing wrong ?

    thanks
     
    epsavit, Nov 10, 2011 IP