Print Reseller Scheme
  1. 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

Discussion in 'Website Design Forum:' started by CSparkes, Sep 3, 2009.

  1. CSparkes

    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


    Would rewrite to



    Would rewrite to


    So that i can have one site being mirrored for several regions without having to take a copy of the site for all regions.
  2. tbwcf

    tbwcf Active Member

    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...
  3. CSparkes

    CSparkes Senior Member

    Kinda is what am after but isn't. Need url for browser to stay with UK at start so to "mask it" as such.
  4. CSparkes

    CSparkes Senior Member

    Had a friend on MSN who has solved problem, Cheers.
  5. br3n

    br3n Senior Member

    Glad I could help.... (lol)
  6. CSparkes

    CSparkes Senior Member

  7. tbwcf

    tbwcf Active Member

    Good news! - what was the solution?
  8. CSparkes

    CSparkes Senior Member

    Its on main desktop so will paste it up tmz.
  9. tbwcf

    tbwcf Active Member

    Cool! - glad to hear you got it sorted!
  10. CSparkes

    CSparkes Senior Member

    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.
  11. tbwcf

    tbwcf Active Member

    Thanks, I'll save that somewhere, sure it will come in handy!

Share This Page