3

I am new to this forum and I have a pretty straight forward question. I have a site www.mysite.com that is the main site with all content. Upon this I have like 20 different domains and now I would like to add domain pointers so all these domains points to the main site. I know how to do this but I would like to define somewhere in the root catalog of the www.mysite.com where these domains shall be redirected to. For example:

domainA.com -> mysite.com/lures
domainB.com -> mysite.com/bait/worms
domainC.com -> mysite.com
domainD.com -> mysite.com/lines/braids
etc....

Is this best done in htaccess file or in a php file or in the index.php file? I am using Joomla 3.x for all my sites. Thanks.

LAMF64
  • 31
  • 2
  • I'd go with .htaccess / vhost as it's technically 'earlier' in the stack, and would require less resources. – Farkie Jan 19 '16 at 08:43
  • When you go to `domainA.com` what do you want the url to be ? Still `domainA.com` or `domainA.com/lures` or redirect to `mysite.com/lures` ? – Florian Lemaitre Jan 19 '16 at 08:48
  • As you se above when domainA is used it shoud be redirected to mysite.com/lures – LAMF64 Jan 19 '16 at 10:25

2 Answers2

1

You can use .htaccess file for this.

It will be something like:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST}   domainA.com
RewriteRule ^/(.*)  http://example.com/lures

This should work.

Also you can do external redirect (http://example.com/lures) or internal redirect where user will still see domainA.com in a browser but , http://example.com/lures page is visible.

Roman Gelembjuk
  • 1,797
  • 2
  • 25
  • 50
0

This looks like the best solution, as I am a newbie when it comes to this kid of coding how do I set up multiple domains, like this?

    RewriteEngine On RewriteBase /  
RewriteCond %{HTTP_HOST} domainA.com
RewriteRule ^/(.*) example.com/lures 
RewriteCond %{HTTP_HOST} domainB.com
RewriteRule ^/(.*) example.com/bait/worms 
RewriteCond %{HTTP_HOST} domainC.com 
RewriteRule ^/(.*) example.com
LAMF64
  • 31
  • 2