I currently use the follwoing code in my .htaccess file
RewriteEngine On
RewriteBase /
# Redirect languages
RewriteRule ^(en|es|zh\-tw|zh\-cn)/?$ index.php?lang=$1 [L]
With that code, every time I type for instance, /en
at the end of the URL, it redirects me to /?lang=en
(loads the the English content from a PHP array):
For instance:
example/en
redirects me to example/?lang=en
while keeping example/en in the URL.
But I also have a thanks.php page and the code above clearly just work for the index.php page.
How can I make the rewrite rule to work for both index.php
and thanks.php
page?