I have searched for this question but couldn't find the exact answer as what I learned is not working.
I have a website that utilizes a script and causes a mess for me, as far as SEO goes. The site has multilingual support so each page (index.php, about.php, etc) has an English version (default) and various other languages that were translated.
So the URL's look like this: example.com/index.php?code=DE (German)
Now if they switch languages on that page is automatically adds that parameter, which means if they were on about.php it would turn into about.php?code=HU
My goal is to rewrite these URL's into subdirectories, like so:
example.com/index.php?code=HR turns into:
example.com/hr/
Or, if I was at example.com/about.php?code=IT turns into:
example.com/it/about
Originally I started out with trying:
RewriteEngine On
RewriteRule ^([^/]+)$ index.php?ccode=$1 [QSA]
I couldn't get this to work correctly and I realize this is much simpler than the idea stated above. I was just trying to get something started and go from there. This wouldn't even work to rewrite to /us (Example)
Any help or ideas would be appreciated.