folder to subdomain

Using a single web hosting account to host multiple sites

folder to subdomain

Postby Dragon_Legion » Wed Nov 12, 2008 5:51 pm

Im trying to get modrewrite to redirect from folders to a subdomain but it refuses to work

Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.empireofages\.com$
RewriteRule ^V2/(.*)$ http://www.empireofages.com/$1 [R=301,L]
RewriteRule ^tracker/(.*)$ http://tracker.empireofages.com/$1 [R=301,L]
RewriteRule ^cgiirc/(.*)$ http://irc.empireofages.com/$1 [R=301,L]
RewriteRule ^acp/(.*)$ http://acp.empireofages.com/$1 [R=301,L]
RewriteRule ^mcp/(.*)$ http://mcp.empireofages.com/$1 [R=301,L]
RewriteRule ^ccp/(.*)$ http://ccp.empireofages.com/$1 [R=301,L]
RewriteRule ^(.*)$ http://www.empireofages.com [R=301,L]


This is based in a subdomain of my main website but it refuses to work at all. Anyone able to help on this?
Dragon_Legion
 
Posts: 5
Joined: Wed Nov 12, 2008 5:48 pm

Postby richardk » Thu Nov 13, 2008 7:39 am

What happens when you got to a sub domain?
Do you have DNS for the sub domains?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Dragon_Legion » Thu Nov 13, 2008 10:39 am

yes the subdomains are valid and they point to those specific folders but I want the address in the URL bar to be the ones in the redirects for a less cluttered URL (In the main section I have an auto redir in the php file if the domain is mine but I dont want to put that in each directory)
Dragon_Legion
 
Posts: 5
Joined: Wed Nov 12, 2008 5:48 pm

Postby richardk » Fri Nov 14, 2008 12:52 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^.+\.empireofages\.com$ [NC]
RewriteCond %{REQUEST_URI} ^/V2/(.*)$
RewriteRule .* http://www.empireofages.com/%1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/(acp|ccp|mcp|tracker)/(.*)$
RewriteRule .* http://%1.empireofages.com/%2 [R=301,L]

RewriteCond %{REQUEST_URI} ^/cgiirc/(.*)$
RewriteRule .* http://irc.empireofages.com/%1 [R=301,L]

RewriteRule .* http://www.empireofages.com/ [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Dragon_Legion » Sat Nov 15, 2008 4:15 pm

it is now giving me a constant redirection

the code I have in the subdomain folders is:
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.empireofages\.com$ [NC]
RewriteRule ^(.*)$ http://www.empireofages.com/$1 [R=301,L]


with a proper redirection for each subdomain and while this works I would really prefer something that is set in 1 htaccess file. The only problem I can see with the 1 htaccess file is that the folder this is all in is not seen by the site Im trying to rewrite to. Should I just go with the code in the subfolders?
Dragon_Legion
 
Posts: 5
Joined: Wed Nov 12, 2008 5:48 pm

Postby richardk » Sat Nov 15, 2008 5:27 pm

What do you mean by a constant redirection?
What mod_rewrite is giving you the constant redirection?

I'm not sure you can use only one .htaccess file. It didn't work when i tried a simple catch all redirect below a sub domain's document root.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Dragon_Legion » Mon Nov 17, 2008 2:38 pm

What I mean is that when I use the main htaccess file it tells me that 'Firefox has detected that this site will never resolve properly.' which I believe is a constant circular redirect
Dragon_Legion
 
Posts: 5
Joined: Wed Nov 12, 2008 5:48 pm

Postby richardk » Tue Nov 18, 2008 11:36 am

Try removing the last RewriteRule.

Also try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^.+\.empireofages\.com$ [NC]
RewriteCond %{REQUEST_URI} ^/V2/(.*)$
RewriteRule .* http://www.empireofages.com/%1 [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_URI} ^/(acp|ccp|mcp|tracker)/(.*)$
RewriteRule .* http://%1.empireofages.com/%2 [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_URI} ^/cgiirc/(.*)$
RewriteRule .* http://irc.empireofages.com/%1 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Dragon_Legion » Thu Nov 20, 2008 3:46 pm

That one didnt help at all. I think Im just gonna use the subdirectory to subdomain htaccess files and not worry about a global redirect.

Thanks for the help Richard
Dragon_Legion
 
Posts: 5
Joined: Wed Nov 12, 2008 5:48 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 8 guests

cron