mod rewrite - mod_rewrite for PHP's "lang?=" for more than one page? -
I am currently using code follwoing in my .htaccess file
RewriteEngine On RewriteBase / #Redirect Language Rev.Rule ^^ (N | SES | zh \ -tw | zh \ -cn) /? $ Index.php? Lang = $ 1 [L]
With that code, every time I type, type / n
at the end of the URL, > /? Redirects to Lang = en (loads the contents of English from the PHP array):
For example:
Example / N example /? Lang = en
But I have a thank.php page and obviously only after the index.php work for the page.
> For both of index.php
and thanks.php
page
The most straight-forward path is just to do this:
RewriteRule ^ (en | es | zh \ -tw | zh \ CN) / $ Index Php? Lang = $ 1 [L] RewriteRule ^ thanks / (en | es | zh \ -tw | zh \ -cn) /? Thanks $ php? Lang = $ 1 [L]
If you want to make it more general, you have the option of white-listing files, such as:
Rewrite $ 1 ^ (thanks) / $ [or] rewrite index ^ (index) $ RewriteRule ^ (./)? (En | es | zh \ -tw | zh \ -cn) /? $% 1.php? Lang = $ 2 [L]
. ..here (thanks)
will be a piped-delimited list of files that you want to have this functionality, or you can accept every request in the form of pass-through from an existing PHP page :
rewrite ^ (en | es | zh \ -tw | zh \ -cn) /? $ Index.php? Lang = $ 1 [L] remit conduit% {DOCUMENT_ROOT} / $ 1.php -f rewrite rule ^ (. *? [^ /]?) / (N | es | zh \ -tw | zh \ -cn) / ? $ $ 1.php? Lang = $ 2 [L]
Comments
Post a Comment