I am a real newbie regarding mod_rewrite so do not laugh. I'm by using this tool for testing: http://civilolydnad.se/projects/rewriterule/

Essentially I wish to rewrite




Here's the very best I possibly could develop:

RewriteRule ^spanish/(.*)$ $1?lang=es [QSA,L,NC]

which appears to operate except once the asked for page already has parameters. For the reason that situation


will get rewritten as


Can anybody help this confused newbie? Thanks greatly.

Something similar to this ought to help.

# Remove query strings from URL
RewriteCond %{THE_REQUEST} ^GET\ /.*\;.*\ HTTP/
RewriteCond %{QUERY_STRING} !^$
RewriteRule .* http://yourdomain.com%{REQUEST_URI}? [R=301,L]

Essentially, the tool is misleading, since the rule was shown to be correct, as written, when utilized on a genuine server atmosphere. Because of all.