News:

Click here for Toll-Free Service for your business starting at $2.00 per month

Main Menu

Domain name for sub-directory

Started by Mojo, December 04, 2005, 03:09:59 PM

Previous topic - Next topic

Mojo

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/

admin

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

x

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?

webzone (archived)

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.

admin

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

Mojo


~Mr-Freeze~

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

webzone (archived)

#7
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.

sixthcrusifix

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.
Visite me website at http://www.sixthcrusifix.com

x

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

webzone (archived)

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?

sixthcrusifix

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.
Visite me website at http://www.sixthcrusifix.com

~Mr-Freeze~

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

Ben

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.
--Ben
Ben@freepgs.com

Daniel

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?