Forum Moderators: phranque
I have four regional sites (England, Northern Ireland, Scotland and Wales, each site resides in a subdirectory in the root diretory of the site (/en,/sc,/wa,/ni). By default the site that users will see will be the English site accessed by www.example.com/, or www.example.com/directory/page.jsp and these pages neeed to be served from the /en/ directory. However, if a user switches to a regional site, Scotland for example, the URLs they will use will be www.example.com/sc/ or www.example.com/sc/directory/page.jsp so I don't think that the mod_rewrite need appply to these.
I need some kind of exclusion clause for /sc/,/wa/,/ni/ folders and redirect to /en/ for / requests but I can't for the life of me figure out what exactly I need.
Can anyone help please?
Thanks,
Mark
RewriteCond %{REQUEST_URI} !^/(sc¦wa¦nl)/
Note that posting on this forum modifies the pipe characters used above - Change all broken pipe "¦" characters to solid pipes before use.
Jim
[edited by: jdMorgan at 1:06 pm (utc) on Aug. 15, 2006]
Now for the "/" bit. Requests made to this URL will be for English pages so all these requests will need to retrieve content from the "/en/" folder in the root of the site but not actually redirect the user's browser to /en/. This redirect of requests will need to be done for all requests made to /, so www.example.com/index.jsp will redirect to www.example.com/en/index.jsp, www.example.com/a_folder/a_page.jsp will redirect to www.example.com/en/a_folder/a_page.jsp etc.
Thanks
[edited by: Mark_Williams at 4:28 pm (utc) on Aug. 15, 2006]
If that's the case, simply rewrite all remaining URLs that do not start with those or with "/en" to the same local URL-path, but with "/en" prepended.
RewriteCond %{REQUEST_URI} !^/(sc¦wa¦nl¦[b]en[/b])/
RewriteRule (.*) /en/$1 [L]
Note that posting on this forum modifies the pipe characters used above - Change all broken pipe "¦" characters to solid pipes before use.
Jim