• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

namecheap hosting plan with subfolder for main domain

B

bogus

Guest
#1
Well, i dont know if this is the correct forum for my question.

I just purchased a hostig plan from namecheap with one domain.

To keep the overview for the main domain and 2 more addon domains, I use subfolders within the so-called "public html" folder.

No one from namecheap support could really help me but i dont want to upload my xenforo into the "public html" folder, i would like to use a subfolder for my main domain too.

From what i see in the cpanel setup options there is nothing to point the main URL to any subfolders.
Instead it looks like i have to use the .htaccess thats located into the "public html" folder to redirect the main url to a subfolder with and without www.

Well, i am looking for someone who can help me with how a htaccess has to look like to redirect, eg.: mydomain.com to /public_html/myfolder

Thanks a lot
 

CurveGotti

Active member
#2
There are quite a few ways to do it, probably the easiest way on a shared server is to create a blank html document in the root called index.html then add a line to htaccess
Code:
Redirect /index.html http://www.YOURDOMAIN.com/YOURSUBDOMAINFOLDER/
 
B

bogus

Guest
#3
At the end i came up with the idea to redirect none www to www.
I really just know a bit about mod rewrite and thats what i have till now. Still not sure if i´ve done it correctly
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([a-z.]+)?mydomain\.org$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .? http://www.%1mydomain.org%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_URI} !myfolder/
RewriteRule ^(.*)$ myfolder/$1 [L]
</IfModule>
The problem i have is, if not all Files are uploaded i do get the directory listing.

Edit: I added a subdomain to mydomain.org which is included into the redirect but shouldn't