2014-06-17 4 views
1

Im пытается переадресовать прослушивание определенного домена. У меня 3 домена; - www.tocdesal.comHtaccess переписать на определенную страницу/язык

  • www.tocdesal.es

  • www.tocdesal.nl

Теперь я хочу добиться этого ..

www.tocdesal .com> www.tocdesal.com/en_GB/

www.tocdesal.nl> www.tocdesal.com/nl_NL/

www.tocdesal.es> www.tocdesal.com/es_ES/

Вот код, я использую, чтобы управлять Multilanguage и запретить людям формировать определенные папки. Надеюсь, кто-то может помочь мне с этой функцией.

<IfModule mod_rewrite.c> 
    # Turn on URL rewriting 
    RewriteEngine On 

    # NON-WWW > WWW 
    #RewriteCond %{HTTP_HOST} ^www\.tocdesal\.nl [NC] 
    #RewriteRule (.*) http://www.tocdesal.nl/nl_NL/home/$1 [R=301,L] 

    # CUSTOM REWRITES 
    #Redirect 301 /[oldlink] [new-full-link] 

    # We dont want snooping people 
    Options -Indexes 

    #RewriteCond %{REQUEST_URI} ^framework.* 

    # If your website begins from a folder e.g localhost/my_project then 
    # you have to change it to: RewriteBase /my_project/ 
    # If your site begins from the root e.g. example.local/ then 
    # let it as it is 
    #RewriteBase /tvmoordrecht 

    # Protect application and system files from being viewed when the index.php is missing 
    RewriteCond $1 ^(framework/modules|framework/coremodules|framework/cicore|application|assets|custommodules) 

    # Rewrite to index.php/access_denied/URL 
    RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L] 

    # Allow these directories and files to be displayed directly: 
    RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|css|js|images|img|fonts|upload|framework/assets/|themes|framework/apps/elfinder|dev-cmslemonupdater|cmslemonupdater) 

    # No rewriting 
    RewriteRule ^(.*)$ - [PT,L] 

    # Rewrite to index.php/URL 
    RewriteRule ^(.*)$ index.php/$1 [PT,L] 
</IfModule> 

ответ

1

Вставьте эти 3 правила сразу после RewriteEngine On линии:

RewriteCond %{HTTP_HOST} ^(?:www\.)?tocdesal\.com$ [NC] 
RewriteRule !^en_GB/ http://www.tocdesal.com/en_GB%{REQUEST_URI} [NE,R=301,L,NC] 

RewriteCond %{HTTP_HOST} ^(?:www\.)?tocdesal\.nl$ [NC] 
RewriteRule^http://www.tocdesal.com/nl_NL%{REQUEST_URI} [NE,R=301,L] 

RewriteCond %{HTTP_HOST} ^(?:www\.)?tocdesal\.es$ [NC] 
RewriteRule^http://www.tocdesal.com/es_ES%{REQUEST_URI} [NE,R=301,L] 
+0

К сожалению, это не сработало. Тем не менее, я получил бесконечный цикл перенаправления. Я думаю, что это проблема в других строках, которые вызывают проблему. У меня нет этого таланта малыша в .htaccess –

+0

Для какого URL вы получаете цикл? – anubhava

+0

Работает сейчас! Большой! Есть ли способ сделать не-www для всех доменов отдельно перейдите на сайт www.tocdesal. * Если это можно сделать im very very happy –

0

Это то, что я есть сейчас. non-www перенаправляет на www для стандартного домена (.com), остальные перенаправляют на язык, на который установлен домен.

<IfModule mod_rewrite.c> 
    # Turn on URL rewriting 
    RewriteEngine On 

    # Redirects to the page with that language selected 

    RewriteCond %{HTTP_HOST} !^www\. 
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

    RewriteCond %{HTTP_HOST} ^(?:www\.)?tocdesal\.nl$ [NC] 
    RewriteRule^http://www.tocdesal.com/nl_NL%{REQUEST_URI} [NE,R=301,L] 

    RewriteCond %{HTTP_HOST} ^(?:www\.)?tocdesal\.es$ [NC] 
    RewriteRule^http://www.tocdesal.com/es_ES%{REQUEST_URI} [NE,R=301,L] 

    # CUSTOM REWRITES 
    #Redirect 301 /[oldlink] [new-full-link] 

    # We dont want snooping people 
    Options -Indexes 

    #RewriteCond %{REQUEST_URI} ^framework.* 

    # If your website begins from a folder e.g localhost/my_project then 
    # you have to change it to: RewriteBase /my_project/ 
    # If your site begins from the root e.g. example.local/ then 
    # let it as it is 
    #RewriteBase /tvmoordrecht 

    # Protect application and system files from being viewed when the index.php is mi 
    RewriteCond $1 ^(framework/modules|framework/coremodules|framework/cicore|applica 

    # Rewrite to index.php/access_denied/URL 
    RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L] 

    # Allow these directories and files to be displayed directly: 
    RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|css|js|images|img|fonts|uplo 

    # No rewriting 
    RewriteRule ^(.*)$ - [PT,L] 

    # Rewrite to index.php/URL 
    RewriteRule ^(.*)$ index.php/$1 [PT,L] 
</IfModule> 
Смежные вопросы