News:

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

Main Menu

subdomain and .htaccess

Started by geminigeek, February 02, 2006, 09:18:30 AM

Previous topic - Next topic

geminigeek

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.

webzone (archived)

If you have a directory dedicated to blog.geminigeek.com, then add this line to .htaccess :

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

GP™

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

geminigeek

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?

x

I think this will work


RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog.geminigeek.com
RewriteRule ^.*$ http://geminigeek.com/blog [R=301,nc]

webzone (archived)

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]

sinex

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

brainiac744

You only need "RewriteEngine On" once. The other two lines you repeat for each subdomain.