![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Beer Money Baron
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]
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
emperor of my world
Join Date: Aug 2004
Location: nethalands
Posts: 29,903
|
no that doesnt make a difference
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
♥ ♦ ♣ ♠
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." |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Too lazy to set a custom title
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Beer Money Baron
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]
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
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] edited a bit |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
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
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Too lazy to set a custom title
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
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.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
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...
|
![]() |
![]() ![]() ![]() ![]() ![]() |