Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

2 domains -> one directory (redirect additional domain)

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
5 posts • Page 1 of 1
AzMandius
Posts: 3
Joined: Fri Feb 28, 2014 5:05 pm
Contact:
Contact AzMandius
Website

2 domains -> one directory (redirect additional domain)
  • Quote

Post by AzMandius » Fri Feb 28, 2014 5:16 pm

Hello everyone,
I am first time here, so nice to meet you all.

I have created a web account for domain: mydomain.md, Vesta automatically created all needed directories for my website inducing the mydomain.md directory itself.

Now i have parked a second domain: myseconddomain.uni.me, and Vesta created another set of needed directories for that domain as well, including the second directory - myseconddomain.uni.me, as this would be a separate website.

Thing is i want both domain to point to one website directory: mydomain.md.
I know it is being done via .htaccess, i have searched here and there, tried many online examples, yet it doesn't work. I may be even placing the .htaccess file in a wrong directory.

Could anyone please help me with an example of .htaccess file to point the second parked domain to another website directory in Vesta?

Thanks a lot!
Top

AFN
Posts: 43
Joined: Sat Feb 01, 2014 2:03 am

Re: 2 domains -> one directory (redirect additional domain)
  • Quote

Post by AFN » Fri Feb 28, 2014 6:17 pm

I think I understand what you are trying to do, and I don't understand please correct me.

Let's say that you purchased the three domain names afn.me, afn.pw and afn.im but you want afn.pw, and afn.im to redirect to afn.me, what you can do so afn.pw, and afn.im is create an index page with the following code

Code: Select all

<meta http-equiv="refresh" content="0; url=http://afn.me" />
and say something like along these lines “you should be redirected to AFN.ME, if for some reason your browser isn't redirecting you to AFN.ME please click here to be taken to AFN.ME.” and also upload a .htaccess file with the following code

Code: Select all

ErrorDocument 404 /index.php
so that way if anyone enters anything it will redirect them to the home page which the homepage will then redirect the visitor to afn.me .

So that is one way how you can add domain names and everything will redirect to one domain name.
Top

AzMandius
Posts: 3
Joined: Fri Feb 28, 2014 5:05 pm
Contact:
Contact AzMandius
Website

Re: 2 domains -> one directory (redirect additional domain)
  • Quote

Post by AzMandius » Fri Feb 28, 2014 7:17 pm

AFN wrote:I think I understand what you are trying to do
Thanks for reply. You did not quite understood my task. I have one website and two working domains, and need it to be fully accessible via bothy domains at same time, i want to keep both domain visible and properly indexing friendly by search engines.
For example, i want the URL http://mypaiddomain.md/directory/file.php to also fully work as http://myfreedomain.uni.me/directory/file.php, and these both URLs are basically displaying the same website.
And that i guess that can be done via .htaccess file only.
Thank you.
Top

ahmiq
Posts: 43
Joined: Mon Jan 13, 2014 10:58 am
Contact:
Contact ahmiq
Website

Re: 2 domains -> one directory (redirect additional domain)
  • Quote

Post by ahmiq » Fri Feb 28, 2014 7:34 pm

AzMandius wrote:
AFN wrote:I think I understand what you are trying to do
Thanks for reply. You did not quite understood my task. I have one website and two working domains, and need it to be fully accessible via bothy domains at same time, i want to keep both domain visible and properly indexing friendly by search engines.
For example, i want the URL http://mypaiddomain.md/directory/file.php to also fully work as http://myfreedomain.uni.me/directory/file.php, and these both URLs are basically displaying the same website.
And that i guess that can be done via .htaccess file only.
Thank you.
You are right , this can be done with the rewrite rules. I have some rewrites rule but it is not point to another domain. It just re-write e-g if you tyme , domain.com/index.html , it will rewrite it to index.php. Here is something from my htaccess , so i think you can take a look and try to modify.

Code: Select all

RewriteEngine On
RewriteBase /

RewriteRule    ^index.html?sid=(.*)$		index.php?sid=$1
RewriteRule    ^index.html				index.php

if it is just for domians and NOT the exact re-writes , i think you can just create a cname for that e-g , sub1.domain.com ---> create a cname for it to domain.com , so if you type sub1.domain.com , it goes to domain.com ,
Top

AzMandius
Posts: 3
Joined: Fri Feb 28, 2014 5:05 pm
Contact:
Contact AzMandius
Website

Re: 2 domains -> one directory (redirect additional domain)
  • Quote

Post by AzMandius » Fri Feb 28, 2014 8:36 pm

Thanks for cname suggestion, I'd still prefer to achieve that using .htaccess.
Top


Post Reply
  • Print view

5 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password