Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-12-2008, 07:16 AM   #1
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
htaccess subdomain & non-www to www redirects.

They seem to interfere with eachother, the non-www to www redirect overwrites the subdomain to subdir redirect so subdomains just go to www.mydomain.com without subdir.

Let me explain the situation, i have subdomains i want to their respective subdir.
So
title.mydomain.com to www.mydomain.com/title/
titletwo.mydomain.com to www.mydomain.com/titletwo/
etc.
But right now i also have the non-www to www redirect code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

But when i add this subdomain to subdir code to the htaccess (which redirects all subdomains to subdirs except when it's www):

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


.... it just redirects the subdomains to the home page www.mydomain.com.
How do i do this?
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 07:19 AM   #2
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
Try this maybe:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.mydomain\.com [NC]
RewriteRule (.*) http://www.mydomain.com/%1/$1 [R=301,L]
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 07:24 AM   #3
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
no that doesnt make a difference
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 07:27 AM   #4
Voodoo
♥ ♦ ♣ ♠
 
Voodoo's Avatar
 
Industry Role:
Join Date: Sep 2002
Location: Porn Valley, CA
Posts: 10,590
EDIT:
Nevermind
__________________

"I'm selflessly supporting the common good, but only coincidentally looking out for No.1."
Voodoo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 07:39 AM   #5
Antonio
Too lazy to set a custom title
 
Antonio's Avatar
 
Join Date: Oct 2001
Location: Spartaaaaaaaaa
Posts: 14,136
not 100% sure but you might need to have wildcard domains enabled on the host?

I know wordpress MU (for multiple blogs on subdomains) won't work unless the host has wildcard domains enabled

anyway, just a guess
Antonio is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 08:09 AM   #6
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
Tested this on mine, so far it worked. Maybe you can mix it up from here.

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
RewriteCond %1 !^(www)$ [NC]
RewriteRule ^$ /%1/$1 [L]
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 08:30 AM   #7
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
Thanks for the effort, but that doesnt work at all doesnt even redirect to the main domain

Let me show you how the htaccess looks:

Code:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$ [NC]
RewriteCond %1 !^(www)$ [NC]
RewriteRule ^$ /%1/$1 [L]
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
And antonio i dont know what you mean


edited a bit

Last edited by nico-t; 11-12-2008 at 08:32 AM..
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 08:46 AM   #8
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
hm i have an idea.. will test it later and report if it worked. Now im having a break
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 09:29 AM   #9
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
i tested it and it works, so dont say it doesnt :p

Code:
Options +FollowSymLinks 
RewriteEngine On 

# force www
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

# abc.domain.com/def --> /subs/abc/def 
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] 
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC] 
RewriteCond %{DOCUMENT_ROOT}/subs/%2%{REQUEST_URI}/ -d 
RewriteRule [^/]$ http://%2.domain.com%{REQUEST_URI}/ [R=301,L] 
RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] 
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC] 
RewriteRule ^(.*)$ /subs/%1/$1 [QSA,L]
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 11:15 AM   #10
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
well thanks but it doesnt work for me..... gonna email my host.
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 11:16 AM   #11
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
bump for nico-t if he didnt get it
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-12-2008, 12:51 PM   #12
nico-t
emperor of my world
 
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
no luck for me fris i see we posted at same time anyway i emailed my host usually they are pretty fast with solving any issues.... ill post here what it is once i get a reply...
nico-t is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.