Welcome to WebmasterWorld Guest from 54.166.114.43

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess redirect domain to subdomain

.htaccess redirect domain to subdomain

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

5+ Year Member



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.
6:36 pm on Nov 29, 2010 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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
 

Featured Threads

Hot Threads This Week

Hot Threads This Month