douzhu7507 2015-11-18 10:25
浏览 19

如何为joomla创建服务器别名

I have a multilanguage website in joomla. The FaLang component creates the following URLs: www.myDutchDomain.nl/nl/

www.myDutchDomain.nl/en/

www.myDutchDomain.nl/de/

I have 2 other URLs which should redirect to English and German URL:

www.myEnglishDomain.eu >> www.myDutchDomain.nl/en/

www.myGermanDomain.de >> www.myDutchDomain.nl/de/

After redirect I want to see myEnglishDomain and myGermandomain in URL. If I'm not mistaken it's called server alias. How can I create a server alias for this purpose?

  • 写回答

1条回答 默认 最新

  • doulu2011 2015-11-18 20:50
    关注

    You should be able to use mod rewrite to solve this by adding lines to your .htaccess file, allowing anything on your country domains 'www.myEnglishDomain.eu/{wildcard}' to be rewritten to the country path '/en/{wildcard}'.

    First you must make sure that the bindings for each domain are pointing to this website.

    Then add the following lines to your .htaccess file:

    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^www.myEnglishDomain.eu$[NC]
    RewriteRule ^(.*)$ /en/$1 [L]
    
    RewriteCond %{HTTP_HOST} ^www.myGermanDomain.de$ [NC]
    RewriteRule ^(.*)$ /de/$1 [L]
    

    If you need the domain within the browser to update to myDutchDomain.nl, then doing the following instead:

    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^www.myEnglishDomain.eu$ [NC]
    RewriteRule ^(.*)$ http://www.myDutchDomain.nl/en/$1 [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^www.myGermanDomain.de$ [NC]
    RewriteRule ^(.*)$ http://www.myDutchDomain.nl/de/$1 [R=301,L]
    

    For further help, here is a mod rewrite cheat sheet: http://www.cheatography.com/davechild/cheat-sheets/mod-rewrite/

    Disclaimer: I have not been able to test the above rules, please let me know if this contains syntax or other errors so to maintain an accurate reference for other people.

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统