News:

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

Main Menu

subdomains with .htaccess

Started by Dondavid, December 19, 2005, 12:49:15 PM

Previous topic - Next topic

Dondavid

Hi, I don't  fully know how I could explain my problem 'cause my English sucks...

I registered a domain: www.creersonsite.fr.nf and a subdomain: forum.creersonsite.fr.nf

I'd like the user to be redirected to www.creersonsite.fr.nf/Forum/ while visiting forum.creersonsite.fr.nf
but I don't want the redirected url to be written in the address bar. I think I must use a .htaccess file.
But I don't know how.
I mean I thought I only had to write this:

RewriteCond  %{HTTP_HOST}  forum.creersonsite.fr.nf
RewriteRule  ^ Forum/{REQUEST_URI}  [L]

But this is not working. Is there anyone who could help me please?

webzone (archived)

#1
You could try this code. I use a very similar one on my site. Or you could just use the solution that the admin offers below.

In /.htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^forum.creersonsite.fr.nf$
RewriteRule ^(.*)$ Forum/$1 [L]


In the subdirectory (in your case, /Forum/.htaccess)

RewriteEngine On
RewriteCond %{HTTP_HOST} !^forum.creersonsite.fr.nf$
RewriteRule ^(Forum/)?(.*)$ http://forum.creersonsite.fr.nf/$2 [L,R=permanent]


This code will map the "forum" subdomain to the Forum subdirectory. It will also redirect visitors from www.creersonsite.fr.nf/Forum/ to forum.creersonsite.fr.nf.

There is more info available about building mod_rewrite instructions on the Apache website.

admin

Please request your subdomains via the Contact Form.

We can directly map these to the directories you specify.  When you added these subdomains the directories were empty so they were not pointed.

In the contact request, please include the subdomain name and the directory you wish to have the subdomain pointed to.

Thank you,
FreePgs.com Admin

webzone (archived)

QuoteWe can directly map these to the directories you specify.  When you added these subdomains the directories were empty so they were not pointed.

Oops! I had forgotten that it was so simple (at least from a users' point of view) when I replied. Looking too far for the solution isn't a good idea obviously.

Dondavid

Ok Thanks you very much indeed for your replies.