I have for example 2 domain names
gl.example
that points to /public_html/
(which has subfolder /public_html/tlf/
)
and tlf.example
that points to the subfolder /public_html/tlf/
How do I redirect so that
if users visit https://gl.example/tlf/example.php
it goes to
https://tlf.example/example.php
Basically I want it everything under gl.example/tlf
to look like it's on nte tlf.example
domain.
Which .htaccess should I edit? The one under public_html/
or the one under /public_html/tlf/
? Would it like do an infinite loop since https://tlf.example
points to the same /tlf
folder?
public_html/gl/
andpublic_html/tlf/
and set the document roots to those respective directories. It is never advisable to have domains in subdirectories of other domains. For an example of the problems it causes see Stop .htaccess automatically influencing subfolderspublic_html/gl/
andpublic_html/tlf/
and set the document roots to those respective directories." - Although if you are on shared hosting then that is probably not possible. However, you could leave/public_html/
as the document root for the main domain (gl.example
) and possibly configure the secondary "addon" domain to point to (ie. set the document root for) a directory outside of the main domain's public HTML space. eg./othersites/tlf/public_html/
- in order to keep the two domains entirely separate.