New Rule
2 posts
• Page 1 of 1
New Rule
So I created a map file with my country names as such;
br br
ca ca
gr gr
I am hoping to be able to check this map file (after all my other rules) and if a pattern matches then append the value to the querystring (in addition to any other values that may already be on the querystring).
For example currently:
http://[domain].com/somepage
would produce a match for http://[domain].com/somepage.asp
At the end of the script, i have added:
RewriteMap evcountry txt:ev_countrydomains.txt
RewriteCond ${evcountry:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^([^?/]+)\/(.*)$ /[^.]+\.[^.]+lan=$1{evcountry:$1} [NC,L,QSA]
However this doesnt seem to work. I am trying to say if a user enters:
http://[domain].com/br/somepage
it will match the map file, so take a previous fule and just add "lan=br" to the querystring (in addition to any other parameters).
if a user just does http://[domain].com/somepage... it will produce no match and hence will just execute rules above this.
Any help in constructing a rule would be much appreciated.
br br
ca ca
gr gr
I am hoping to be able to check this map file (after all my other rules) and if a pattern matches then append the value to the querystring (in addition to any other values that may already be on the querystring).
For example currently:
http://[domain].com/somepage
would produce a match for http://[domain].com/somepage.asp
At the end of the script, i have added:
RewriteMap evcountry txt:ev_countrydomains.txt
RewriteCond ${evcountry:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^([^?/]+)\/(.*)$ /[^.]+\.[^.]+lan=$1{evcountry:$1} [NC,L,QSA]
However this doesnt seem to work. I am trying to say if a user enters:
http://[domain].com/br/somepage
it will match the map file, so take a previous fule and just add "lan=br" to the querystring (in addition to any other parameters).
if a user just does http://[domain].com/somepage... it will produce no match and hence will just execute rules above this.
Any help in constructing a rule would be much appreciated.
Re: New Rule
Hello.
To tell more I need to see your whole .htaccess, but please try this first:
or this depending on your .htaccess context level:
And if country code is always two character long and you don't have real two character folders you can omit map file part:
To tell more I need to see your whole .htaccess, but please try this first:
- Code: Select all
RewriteMap evcountry txt:ev_countrydomains.txt
RewriteCond ${evcountry:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(\w{2})(/.*) $2\?lan=$1 [NC,L,QSA]
or this depending on your .htaccess context level:
- Code: Select all
RewriteMap evcountry txt:ev_countrydomains.txt
RewriteCond ${evcountry:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^/(\w{2})(/.*) $2\?lan=$1 [NC,L,QSA]
And if country code is always two character long and you don't have real two character folders you can omit map file part:
- Code: Select all
RewriteRule ^(\w{2})(/.*) $2\?lan=$1 [NC,L,QSA]
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 18 guests