Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
July 31, 2010, 09:25:41 PM

Pages: [1]   Go Down
  Print  
Author Topic: Can I use my main domain in a subdirectory?  (Read 351 times)
trying2learn
Newbie
*
Offline Offline

Posts: 5


« on: January 15, 2010, 11:58:12 AM »

I couldn't find an answer to this in these posts, so i thought to post it myself.

I have three domains under one account.  The two addon domains work fine (ithink) thanks to the Addon Domain Maintenance. They both link to the websites with no problem.

I'm having problems with my main domain (the one i signed up the account with).  Lets say its www.onemainsite.com.
I wanted to create a subdirectory (one) under public html/ one/ and put all my files for that site under there. The only thing is when i type www.onemainsite.com on a browser, it goes to the main root (or area of the account) and it showed my other subfolders and sites.  I found the way to secure that under .htaccess. But I have to type www.onemainsite.com/one just to view the site online. 

How do I get it to direct it so that I can just use www.onemainsite.com?
Logged
MrPhil
Professor in Nanotechnology
*****
Offline Offline

Posts: 4760



« Reply #1 on: January 15, 2010, 02:45:50 PM »

Quote
I couldn't find an answer to this in these posts, so i thought to post it myself.
Asked, and answered, many times before.

Either redirect onemainsite.com to onemainsite.com/one via your control panel, or in /.htaccess:
Code:
RewriteEngine On
RewriteCond  %{HTTP_HOST}  ^(www\.)?onemainsite\.com  [NC]
RewriteCond  %{REQUEST_URI}  !^/one  [NC]
RewriteRule  ^(.*)$  /one/$1  [R=302]

This assumes that you don't want visitors (and search engines) to see they've been redirected to /one. If you do, change R=302 to R=301.

If it should end up also redirecting your two add-on domains to /one, it means that they are coming in as onemainsite.com/addonone/ or addontwo/. In that case, add
Code:
RewriteCond  %{REQUEST_URI}  !^/addonone  [NC]
RewriteCond  %{REQUEST_URI}  !^/addontwo  [NC]
just before the "RewriteRule" line.
Logged

trying2learn
Newbie
*
Offline Offline

Posts: 5


« Reply #2 on: January 18, 2010, 06:22:09 AM »

thanks this worked great.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: