FreePgs.com Forum

FreePgs Related => Support Requests => Topic started by: Mojo on December 04, 2005, 03:09:59 PM

Title: Domain name for sub-directory
Post by: Mojo on December 04, 2005, 03:09:59 PM
I searched through the "Support Requests" category but I couldn't find an answer to this question. Is it possible to point a domain name to a sub-directory? Like this:

Domain name = http://www.freepgs.com/username/subdirectory/
Title: Re: Domain name for sub-directory
Post by: admin on December 04, 2005, 04:38:38 PM
Domains can only be pointed to the main directory within your account (if you use the Direct hosting option).

You can use the URL forwarding/masking features of your registrar to point to alternate URLs

Thank you,
FreePgs.com Admin
Title: Re: Domain name for sub-directory
Post by: x on December 04, 2005, 11:05:16 PM
I asked this in the chat room a few days ago. Then i was thinking, I read that *.domain.com can be pointed to your website then using a .htaccess command redirect it to a subdirectory.

Would it not be possible to add the domain using the domain add feature, have it point to the normal place then use htaccess to direct it to a subdirectory?
Title: Re: Domain name for sub-directory
Post by: webzone (archived) on December 04, 2005, 11:17:31 PM
QuoteWould it not be possible to add the domain using the domain add feature, have it point to the normal place then use htaccess to direct it to a subdirectory?

Do you want to do this for all your domains and your FreePgs directory (www.freepgs.com/username)?

If yes, you could put something like this in your .htaccess in your root directory :
RewriteEngine On
RewriteRule ^(DIRECTORY\/)?(.*)$ DIRECTORY/$2 [L]


Of course, the code can be changed to handle more domains individually or redirect people based on the subdomain, but these are the basics.
Title: Re: Domain name for sub-directory
Post by: admin on December 04, 2005, 11:24:09 PM
You would just need to request the *.yourdomain.com entry to be added to your account.

And use either an .htaccess file or a php script that will redirect the domain to the correct content.

Thank you,
FreePgs.com Admin
Title: Re: Domain name for sub-directory
Post by: Mojo on December 05, 2005, 09:06:16 PM
Thanks for the tips guys!
Title: Re: Domain name for sub-directory
Post by: ~Mr-Freeze~ on December 05, 2005, 10:39:09 PM
will the option panal ever be changed to allow us to poin a domain to a sub dir?
how do i set up the htaccess could you make a eg of it with the url& dir in it thanks
Title: Re: Domain name for sub-directory
Post by: webzone (archived) on December 06, 2005, 12:05:35 AM
Quotewill the option panal ever be changed to allow us to poin a domain to a sub dir?
Quote from: adminDomains can only be pointed to the main directory within your account (if you use the Direct hosting option).

Quotehow do i set up the htaccess could you make a eg of it with the url& dir in it thanks

That is exactly what I wrote...
RewriteEngine On
RewriteRule ^(DIRECTORY\/)?(.*)$ DIRECTORY/$2 [L]


Only change Directory to the appropriate subdirectory and place this in the .htaccess file of your root directory.
Be warned that this will apply to all URLs of your site (freepgs.com/username and ALL your domains).

If you need to apply this change to only ONE domain, put this code in /.htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?EXAMPLE.NET$
RewriteRule ^(DIRECTORY\/)?(.*)$ DIRECTORY/$2 [L]


Then, in DIRECTORY/.htaccess, write the following code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?EXAMPLE.NET$
RewriteRule ^(DIRECTORY/)?(.*)$ http://www.EXAMPLE.NET/$2 [L,R=301]


As with the first example above, you will need to update a few values before pasting the code.
Title: Re: Domain name for sub-directory
Post by: sixthcrusifix on December 07, 2005, 09:18:40 PM
there are so many weird replies I can read them.


But as for the first questions Yes and no, if you have a control panel with the people you bought your domain from you could use domain forwarding to get to the subdirectory when people typed in the URL. Unfortunately you'd still see http://freepgs.com/username/subdirectory.

I think the post above me has the best answer.
Title: Re: Domain name for sub-directory
Post by: x on December 07, 2005, 10:51:05 PM
Quote from: sixthcrusifix on December 07, 2005, 09:18:40 PM
there are so many weird replies I can read them.


But as for the first questions Yes and no, if you have a control panel with the people you bought your domain from you could use domain forwarding to get to the subdirectory when people typed in the URL. Unfortunately you'd still see http://freepgs.com/username/subdirectory.

I think the post above me has the best answer.

but that looks a bit cheap and amatureish
Title: Re: Domain name for sub-directory
Post by: webzone (archived) on December 07, 2005, 10:54:37 PM
Quotebut that looks a bit cheap and amatureish

That's why you could also use the rewrite code I wrote about a few posts above.
Why do you want your site to be in a subdirectory anyway?
Title: Re: Domain name for sub-directory
Post by: sixthcrusifix on December 08, 2005, 08:00:32 AM
Quote from: webzone on December 07, 2005, 10:54:37 PM
Quotebut that looks a bit cheap and amatureish

That's why you could also use the rewrite code I wrote about a few posts above.
Why do you want your site to be in a subdirectory anyway?

he may have 2 domain names for 2 sites but doesn't want to get more hosting so he can just use his 1 freepgs.com account to host teh files for both sites.
Title: Re: Domain name for sub-directory
Post by: ~Mr-Freeze~ on December 20, 2005, 02:33:55 AM
thanks but  i'm still lost

u dont get .subdomains ? do u?

i have a folder called Vietcong2 domain http://vietcong-2.be
main domain http:auto-surfs.info

how to i make the vietcong domain go to the vietcong folder

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?vietcong-2.be$
RewriteRule ^(DIRECTORY\/)?(.*)$ DIRECTORY/$2 [L]

where do i put Vietcong2

thanks

would be a lot easery if we just had cpanel realy y should we need 2 mess around with this
Title: Re: Domain name for sub-directory
Post by: Ben on December 20, 2005, 03:54:36 PM
You can have up to -2- subdomains, and they can be linked to a folder directly by the system.
Domains, however, can only be linked to your account. You can use mod_rewrite to move them elsewhere.

and I believe you need to change BOTH of the "DIRECTORY" with your directory.

And FreePgs has never, and most likely will never, use cPanel. The FreePgs system relies on a lot of customization, and cpanel doesn't allow the same customization. That's why Plesk isn't on the same server anymore - it was limiting our php version, and causing other server troubles.
Title: Re: Domain name for sub-directory
Post by: Daniel on March 11, 2006, 07:53:45 PM
Ok, I am trying to redirect my domain www.iceman90.com to a subfolder /iceman90

I have this in my .htaccess file


RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?iceman90.com$
RewriteRule ^(DIRECTORY\/)?(.*)$ iceman90/$2 [L]


But I get a 500 Internal Server Error

Could someone please tell me what I am doing wrong?
Title: Re: Domain name for sub-directory
Post by: webzone (archived) on March 12, 2006, 12:40:42 AM
First of all, you need to change the two occurrences of "DIRECTORY".

If it still doesn't work, leave the code in your /.htaccess and add the following code in /iceman90/.htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?iceman90.com$
RewriteRule ^(iceman90/)?(.*)$ http://www.iceman90.com/$2 [L,R=permanent]
Title: Re: Domain name for sub-directory
Post by: Daniel on March 12, 2006, 08:24:27 PM
Thanks.

I've got it working now.
Title: Re: Domain name for sub-directory
Post by: milkywaylynx on July 29, 2006, 08:36:46 PM
I'm having a problem with this...

In root/.htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?uhsamc\.hopto\.org$
RewriteRule ^(club\/)?(.*)$ club/$2 [L]

I also put this in root/club/.htaccess, but it doesn't make a difference (even without it, the url still works):

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?uhsamc.hopto.or$
RewriteRule ^(club/)?(.*)$ http://uhsamc.hopto.org/$2 [L,R=301]

"uhsamc.hopto.org" should point to root/club. This works. However, when I try to access a folder called "test" in club, if I type in "uhsamc.hopto.org/test", it redirects me to "uhsamc.hopto.org/club/test". Any way to allow me to type in "uhsamc.hopto.org/test" and not have it redirect to "uhsamc.hopto.org/club/test"?