FreePgs.com Forum

FreePgs Related => Support Requests => Topic started by: geminigeek on February 02, 2006, 09:18:30 AM

Title: subdomain and .htaccess
Post by: geminigeek on February 02, 2006, 09:18:30 AM
my webhost kept on going down and i plan to switch to freepgs soon.

so anyway, on my current site, i am using blog.geminigeek.com. How do i redirect my visitor from blog.geminigeek.com to geminigeek.com/blog? And yea, I want the address on the browser change too. i know we can use .htaccess to do this, but im not sure how.

And, is it possible to redirect any directory under blog.geminigeek.com to geminigeek.com/blog?

thanks in advance.
Title: Re: subdomain and .htaccess
Post by: webzone (archived) on February 03, 2006, 03:16:33 AM
If you have a directory dedicated to blog.geminigeek.com, then add this line to .htaccess :

Redirect permanent / http://geminigeek.com/blog/
Title: Re: subdomain and .htaccess
Post by: GP™ on February 03, 2006, 05:37:46 AM
Not sure if this can be done via htaccess... but i'm not a expert on apache or htaccess...

I do know we can set up (Two) 2 subdomains on your account if you want that to be pointed to /blog

L8r.
Gordon
Title: Re: subdomain and .htaccess
Post by: geminigeek on February 03, 2006, 12:22:12 PM
Quote from: webzone on February 03, 2006, 03:16:33 AM
If you have a directory dedicated to blog.geminigeek.com, then add this line to .htaccess :

Redirect permanent / http://geminigeek.com/blog/

i tried putting that code in my .htaccess in my /blog directory, but it doesnt seem to work. it messes up everything. that code redirect my site to infinite number of /blog. is it because the default code generated by my wordpress messes up everything?
Title: Re: subdomain and .htaccess
Post by: x on February 03, 2006, 02:34:45 PM
I think this will work


RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog.geminigeek.com
RewriteRule ^.*$ http://geminigeek.com/blog [R=301,nc]
Title: Re: subdomain and .htaccess
Post by: webzone (archived) on February 04, 2006, 12:43:31 AM
Quote from: geminigeeki tried putting that code in my .htaccess in my /blog directory, but it doesnt seem to work. it messes up everything. that code redirect my site to infinite number of /blog. is it because the default code generated by my wordpress messes up everything?

Check that wordpress has the correct "WordPress URI" its options section. If that doesn't fix the problem, it is probably because blog.geminigeek.com and /blog point to the same directory.

Quote from: xI think this will work

Would need some changes, as it might break WordPress. Plus, it will redirect people from a specific article on the subdomain to the homepage. Just to be safe, the corrected code is below.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^blog.geminigeek.com$
RewriteRule ^(.*)$ http://geminigeek.com/blog/$1 [L,R=301]
Title: Re: subdomain and .htaccess (+2 subdomains: main .htaccess)
Post by: sinex on July 26, 2006, 09:53:39 PM
For 2 subdomains:
Do we have to repeat the 3 lines of the .htacces on main directory, in one file?
like that:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?aranjosflorais.net$
RewriteRule ^(aranjosflorais\/)?(.*)$ aranjosflorais/$2 [L]

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

YES?
And of course proper normal .htaccess in each directory.
Like that we can have 3 domains on one account
Thanks to answer
Title: Re: subdomain and .htaccess
Post by: brainiac744 on July 27, 2006, 02:45:58 AM
You only need "RewriteEngine On" once. The other two lines you repeat for each subdomain.