I am no .htaccess expert, but I have attempted a couple of various things to redirect a website with no success.

I have got a United kingdom and US domain...some US pages have united kingdom extension, and have to be pointed towards the proper United kingdom domain:

world wide web.domain.com/united kingdom must be rewritten to world wide web.domain.co.united kingdom/united kingdom

Ex. If a person types in world wide web.domain.com/united kingdom/about it will likely be rewritten as world wide web.domain.co.united kingdom/united kingdom/about

Edit: Pathways with /united kingdom ought to be rewritten

So world wide web.domain.com/united kingdom and world wide web.domain.co.united kingdom ought to be rewritten to world wide web.domain.co.united kingdom/united kingdom/

You can test something similar to this:

RewriteEngine on

RewriteCond % ^(www.)?domain.com$ [NC]

RewriteRule (.*) http://world wide web.domain.co.united kingdom/$1 [L,R=301]

The key point is by using a RewriteCondition that creates the HTTP Host header. In other words, if your RewriteCond is positioned before an ordinary RewriteRule then your rule is just used when the the problem matches.

The code excerpt above redirects all demands in the .COM towards the .CO.United kingdom domain, if you only have to redirect certain directory, you will want to regulate the rule accordingly, e.g.:

RewriteEngine on

RewriteCond % ^(www.)?domain.com$

RewriteRule united kingdom(.*) http://world wide web.domain.co.united kingdom/united kingdom$1 [L,R=301]

Edit: Hopefully this works for you personally based on your edit.

The very first rule rewrites http://world wide web.domain.com/united kingdom and http://world wide web.domain.com/united kingdom/anything to http://world wide web.domain.co.united kingdom/united kingdom/anything.

The 2nd rule rewrites http://world wide web.domain.co.united kingdom to http://world wide web.domain.co.united kingdom/united kingdom/.

Edit 2: I transformed the rule (modified the final one and added a different one) to mirror the interest in rewrites on .co.united kingdom/something. When the path begins with united kingdom/ it just passes through, otherwise it will get rewritten to united kingdom/something.

RewriteEngine On

RewriteCond % ^(www.)?domain.com$ [NC]

RewriteRule united kingdom($/.*) http://world wide web.domain.co.united kingdom/united kingdom$1 [L,R=301]

RewriteCond % ^(www.)?domain.co.united kingdom$ [NC]

RewriteRule ^united kingdom/(.*) - [PT,L]

RewriteCond % ^(www.)?domain.co.united kingdom$ [NC]

RewriteRule (.*) http://world wide web.domain.co.united kingdom/united kingdom/$1 [L,R=301]