homepage Welcome to WebmasterWorld Guest from 54.226.213.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
.htaccess redirect domain to subdomain
.htaccess redirect domain to subdomain
jabz




msg:4227097
 2:08 pm on Nov 5, 2010 (gmt 0)

Hi,
for some hours I am trying to get a complex set of redirects working, without luck so far.

I have studied this post [webmasterworld.com...] in order to adapt the code to what I want.


Description of what I want to do:
================
      I want to set up a bilingual website.


      Each of the two languages shall have it's own subdomain. In my case German (de.domain.com) and English (en.domain.com).


      Default language is supposed to be English. Therefore, I plan to redirect all requests (www.domain.com and domain.com) to the en.domain.com subdomain.


      The different language contents will be placed in language folder domain.com/en/ and domain/de/ in domain root.


      I also want to Rewrite Extensionless URLs for HTML and PHP files.


      I also want to force a trailing slash on all folders


      There will be no readable files in domain root.



Can anybody help me? I can't see the wood for the trees anymore. Thanks.

 

jdMorgan




msg:4236386
 6:36 pm on Nov 29, 2010 (gmt 0)

Each of the two languages shall have it's own subdomain. In my case German (de.domain.com) and English (en.domain.com).
Default language is supposed to be English. Therefore, I plan to redirect all requests (www.domain.com and domain.com) to the en.domain.com subdomain.

Externally redirect ^(www\.)?domain.com/<anything> to /en.domain.com/<anything>

The different language contents will be placed in language folder domain.com/en/ and domain/de/ in domain root.

Internally rewrite <two-letters>.domain.com/ to /<two-letters>

I also want to Rewrite Extensionless URLs for HTML and PHP files.

Internally rewrite requests for /<anything-with-no-period-in-last-part-of-path> to </<anything-with-no-period-in-last-part-of-path>.html if </<anything-with-no-period-in-last-part-of-path>.html exists (see RewriteCond "-f" flag) AND
rewrite requests for /<anything-with-no-period-in-last-part-of-path> to </<anything-with-no-period-in-last-part-of-path>.php if </<anything-with-no-period-in-last-part-of-path>.php exists

See the "Cruft-free URLs" thread in our Apache Forum Library.

I also want to force a trailing slash on all folders

Done automatically by Apache mod_dir

I can't see the wood for the trees anymore.

Break the problem into smaller pieces, and work on only one piece at a time. (Take a few steps back from the forest so that you can see only a few trees).

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved