.htaccess Regional URL Re-Writes

CSparkes

Senior Member
OK need an htaccess expert to help with a url rewrite.

Need to so that the first section of a url is taken if listed in htaccess file and then adds a url info at end.

For example

/uk/REST/OF/WEBADDRESS

Would rewrite to

/REST/OF/WEBADDRESS?region=1


/us/REST/OF/WEBADDRESS

Would rewrite to

/REST/OF/WEBADDRESS?region=2

So that i can have one site being mirrored for several regions without having to take a copy of the site for all regions.
 
I think that sounds like you want a 301 redirect? if you google it you might get what your looking for...

Failing that Jaz on here would be your man, if he doesn't pop along and googles no help send him a pm...
 
Kinda is what am after but isn't. Need url for browser to stay with UK at start so to "mask it" as such.
 
RewriteEngine on

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !.cfm
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://localhost:8888/$1/ [L,R=301]

RewriteRule uk/powerkites(.*)/$ website/$1/?regionid=uk&sportid=powerkites
RewriteRule uk/powerkites(.*).cfm$ website/$1.cfm?regionid=uk&sportid=powerkites


The first part forces a trailing forward slash.
 
Back
Top