News:

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

Main Menu

Various domains in one account

Started by lolo_bee, November 18, 2006, 09:15:08 AM

Previous topic - Next topic

lolo_bee

Hello!, I used the form to setup some domains (www.marchadenoche.es and www.beedesigns.es), in my domain DNS settings there's an A and CNAME entry as you ask for, and both of them uses URL forwading, one of them point to http://xxxxxxx.freepgs.com/site1 and the other points to http://xxxxxxx.freepgs.com/site2, but when I try to open it in browser, both of them points to root directory of my account http://xxxxxxx.freepgs.com/

I don't know if I missed up something in the configuration or it's not posible and I have to use mod_rewrite (It's the first time I heard about it)

Best regards. Lolo

P.S.: Sorry for my bad english  ::)

admin

You cannot have domain forwarding and A records defined at the same time.  If you define A records, your registrar will no longer be able to forward to a specific URL.

You will need to create mod_rewrite rules inside of an .htaccess file to redirect users to the correct directory within your site.
(You can search this forum for instructions)

Thank you,
FreePgs.com Admin

lolo_bee

OK, I was wondering this.

Second part, I'have used mod_rewrite and everything works perfect, but, if I point to a sub-subfolder, the url changes

Example:
my account: lolo_bee.freepgs.com (now accesible from domain www.marchadenoche.es)
website is in folder: /marchadenoche
chat folder: /marchadenoche/chat

if I poin to www.marchadenoche.es, the url does not change (I used mod_rewrite), but if I point to www.marchadenoche.es/chat, the URL changes to www.marchadenoche.es/marchadenoche/chat

I've been trying to use mod_rewrite here, in Chat sub-subfolder, like in another post, but I can't make it work. Any Ideas?

Best regards. Lolo


admin

Post the code you used in your .htaccess file and I am sure someone will be able to correct it for you.

(You can also use the search function to find code snipplets that do work)

Thank you,
FreePgs.com Admin

lolo_bee

This is directory structure for my web

/beedesigns
/marchadenoche
/marchadenoche/chat
/marchadenoche/foro


my .htaccess file in root folder is:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?beedesigns.es$
RewriteRule ^(beedesigns\/)?(.*)$ beedesigns/$2 [L]
RewriteCond %{HTTP_HOST} ^(www\.)?marchadenoche.es$
RewriteRule ^(marchadenoche\/)?(.*)$ marchadenoche/$2 [L]


.htaccess file in /marchadenoche is

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


Everything works OK, but when i point to www.marchadenoche.es/chat the url changes to http://www.marchadenoche.es/marchadenoche/chat/
I tried to put an .htaccess file on /marchadenoche/chat folder like this one:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?marchadenoche.es$
RewriteRule ^(marchadenoche/chat/)?(.*)$ http://www.marchadenoche.es$2 [L,R=301]


but i got this url http://www.marchadenoche.es/marchadenoche/chat/

I've been trying some logic changes, and also read mod_rewrite documentation, but, i can't understand some characters like ^ or $

Best Regards. Lolo

admin

#5
I have commented the .htaccess file directives in the above two directories.  (These directives are not needed)

Further more, the reason that
http://www.marchadenoche.es/chat Redirected to http://www.marchadenoche.es/marchadenoche/chat/ is because Apache will reconstruct the URL as it actually exists when it redirects.  (This is done before .htaccess files are parsed)

The proper URL to link is http://www.marchadenoche.es/chat/ (notice the final slash)  Without that slash, apache attempts to find a file with that name.  The directory is found and the user is redirected to it.

I have solved the problem by adding the domain marchadenoche.es as a subdomain on your account.  This then causes apache to know the correct URLs when a URL like /chat is provided (that redirects to the directory /chat/).

Please try it out and let me know if this will work for you.

(Please be sure to leave the directives commented for marchadenoche.es in your .htaccess file as we are not using them when adding as a subdomain)  Also, the .htaccess files within the subdirectories are not needed (they have been commented as well)

The trailing slash problem is mentioned on http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html, however it adds processing overhead (which is not necessary when we can add the domain as a subdomain on your account for direct resolution to the correct path)

Thank you,
FreePgs.com Admin

admin

For more information on what the special characters and flags do, you can visit

http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule (RewriteRule syntax/directives)
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritecond (RewriteCond syntax/directives)

And of course the overview document at http://httpd.apache.org/docs/2.0/rewrite/rewrite_intro.html

Thank you,
FreePgs.com Admin

lolo_bee

Ok, everything works fine! but i'll read documentation.

Thanks for a cool support!  ;D