• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

.htaccess Regional URL Re-Writes


CSparkes

Senior Member
#1
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.
 

tbwcf

Active Member
#2
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...
 

CSparkes

Senior Member
#10
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.