Category Archives: ampersand

string cut off after ampersand when using mod rewrite

If I have a variable with an ampersand, and try to echo the variable in php, the string is cut off at the ampersand when using mod rewrite URL's.

The variable is search & search

When using:


I can echo the complete variable. search & search

When using rewritten URL's:


I echo the variable and it prints search

What needs to be added to htaccess to fix this?

current htaccess:

RewriteCond %{THE_REQUEST} /page\s=([^&\s]+) [NC]
RewriteRule ^ page/%1? [L,R=302,NE]

RewriteRule ^page/([^/]+)/?$ page.php?s=$1 [L,QSA]