Redirect to a sub-folder

Avatar
  • updated
  • Answered

Hi, I bought a new HTML template which only works if it's installed in a *sub-folder* in public_html. 

I need the main domain to redirect to the subfolder automatically.  And if possible, mask the subfolder name so they don't see its name, just the content inside.

How can I do this?

Pinned replies
Avatar
Ronnie H.
  • Answer
  • Answered

Hello!  All you need to do is use cPanel's file manager to create a new folder in public_html and put the file there. Then, it will be accessible whenever you visit your url with that subfolder on the end. Think something like example.com/nameofyourfolder/pageusingtemplate.html. 

Short term, you can just set up a redirect in cPanel or the .htaccess file that sends all visitors to your domain to that page in the subfolder. 

You can try setting up an alias domain, there are quirks when you try doing this within the same domain itself. Long term, your best bet is going to be rewriting, or having your developer rewrite, that template so it just works on the main index.html or index.php page. I say this as a troubleshooter, not as a web developer though, so without further knowledge on the template you're using I don't know how feasible that is. Hope that helps you get started though!

Avatar
Ronnie H.
  • Answer
  • Answered

Hello!  All you need to do is use cPanel's file manager to create a new folder in public_html and put the file there. Then, it will be accessible whenever you visit your url with that subfolder on the end. Think something like example.com/nameofyourfolder/pageusingtemplate.html. 

Short term, you can just set up a redirect in cPanel or the .htaccess file that sends all visitors to your domain to that page in the subfolder. 

You can try setting up an alias domain, there are quirks when you try doing this within the same domain itself. Long term, your best bet is going to be rewriting, or having your developer rewrite, that template so it just works on the main index.html or index.php page. I say this as a troubleshooter, not as a web developer though, so without further knowledge on the template you're using I don't know how feasible that is. Hope that helps you get started though!