0

Sorry if this is in the wrong section (PHP), but wasn't sure where to put htaccess issues....

Here's the deal - I have two domains, let's say domain1.com and domain2.com. On my web server, I have domain1 set up as the primary domain (/public_html/), and domain2 is an addon domain (/public_html/domain2.com/).

What I'd like to accomplish through .htaccess is to access my files from domain1 through domain2, which is shorter - so for example, if under domain1 I have a /admin/ folder (accessed through domain1.com/admin/), I'd like to also be able to access it through domain2.com/admin/. Would this be possible (without redirecting one entire site to the other, since they serve different purposes) through .htaccess?

3
Contributors
9
Replies
10
Views
7 Years
Discussion Span
Last Post by pritaeas
0

Well, I have no idea how to do that with HTACCESS, but maybe you could post the server you use ... maybe someone knows of a tool that'll let you do that.

0

I'm under shared hosting (Apache environment), so htaccess would probably be my best bet...

0

By accessing your files, do you mean in (php) code ? If so, if you use absolute paths the files should all be accessible to you.

0

Something like this:

RewriteCond %{http_host} ^domain2.com [nc]
RewriteRule ^(.*)$ http://www.domain1.com/$1

If you want this for just specific files, just replace the .*

Thanks for that, but I already knew about a full-domain redirect - I mentioned in the OP that:

I'd like to also be able to access it through domain2.com/admin/. Would this be possible (without redirecting one entire site to the other, since they serve different purposes)

This is the real problem here =\

Thanks for the attempt though...

0

So I would have to do this for every single file in both domains?

Not exactly what I was looking for, but I guess for one or two files I could employ this...

Perhaps I'm to blame though, I don't think I made myself clear enough - I would like to be able, for both domains, to be able to access ANY file or folder (e.g. http://domain1.com/file.txt or http://domain1.com/folder/) through the other domain (http://domain2.com/file.txt or http://domain2.com/folder/), AND VICE VERSA, so the two domains are 'interworking' to access the same files through their respective URLs. I know it's quite a big ask but... Just wanted to know if I could do anything like this.

0

Hmz, don't think that is possible throught htaccess, because that could cause infinite redirect loops. Sounds more like you want a load-balancer, but that would make only sense between two different servers.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.