30019

htaccess rewrite multi domain

Question:

i have a 2 domain website.

Basically, the 2 domains are for my multilanguage visitors. What i need is to rewrite domain1.com/en/ to domain2.com, so that user will be able to see the english version of the site by just typeing the domain2.com in the address bar instead of domain1.com/en/. Any tips?

and btw: i'm using php / apache..

EDIT:both domains point to the same hosting account...

tnx!

Answer1:

Add these lines to your .htaccess file in the root folder of your website.

RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com/en [L,R=301]

Answer2:

I'm not sure you can use an .htaccess file for another domain.<br /> I think you might need to play with the domain DNS settings.

Or use an iFrame like in 1996 :D

Recommend

  • Jekyll Deployment on Github Pages doesn't format correctly (No styling)
  • PHP create range of dates
  • R - How can I change date format when I plot an xts & zoo object?
  • Removing the Edit on Github link when using Read The Docs & Sphinx with ReadTheDocs Theme
  • Share session on subdomains in php
  • FolderBrowserDialog crashes the application
  • How do I convert a ResultSet in a List of Hashtable?
  • Excluding multiple values from the array
  • Kill Active Session if User Is Banned
  • byebug, next into application code only
  • Selection Sort, For Java
  • Fraction length
  • Custom locale in Android
  • CFBundleDevelopmentRegion not works as expected
  • File extension of zlib zipped html page?
  • iOS Cordova first plugin - plugin.xml to inject a feature
  • XSLT foreach repeating nodes to flat
  • JPA flush vs commit
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • pillow imaging ImportError
  • Problem deserializing objects from cache on MyBatis 3/Java
  • Meteor: Do Something On Email Verification Confirmation
  • Cannot resolve symbol 'MyApi'
  • All Classes Conforming to Protocol Inherit Default Implementation
  • How to get address from latitude and longitude android google map v2 [duplicate]
  • Cannot connect to cassandra from Spark
  • Align navbar back button on right side
  • Window Size for Mac application
  • Deserializing XML into class C#
  • Upload files with Ajax and Jquery
  • Websockets service method fails during R startup
  • Do I've to free mysql result after storing it?
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • A cron job substitute?
  • How to include full .NET prerequisite for Wix Burn installer
  • json Serialization in asp
  • using HTMLImports.whenReady not working in chrome
  • costura.fody for a dll that references another dll
  • How to push additional view controllers onto NavigationController but keep the TabBar?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize