| | |
.htaccess - remove www. except when https
![]() |
Hello,
I am trying to remove the www. at the beginning of our domain name via .htaccess. I'm doing it like this:
It seems to word wonderfully.
I would like to retain the www. when someone accesses the site securely with https. I found a bit of code on the web that described how to force the www. except on a certain folder ("blog" in this case):
I thought if I changed it a little, I could make at least a single folder keep the www. like this:
It didn't work. I got a redirect loop error.
Any ideas?
I am trying to remove the www. at the beginning of our domain name via .htaccess. I'm doing it like this:
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R,NC]I would like to retain the www. when someone accesses the site securely with https. I found a bit of code on the web that described how to force the www. except on a certain folder ("blog" in this case):
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule !^blog(/.*)?$ http://www.domain.com%{REQUEST_URI} [R,L]I thought if I changed it a little, I could make at least a single folder keep the www. like this:
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule !^secure(/.*)?$ http://.domain.com%{REQUEST_URI} [R,L]It didn't work. I got a redirect loop error.
Any ideas?
![]() |
Other Threads in the Linux Servers and Apache Forum
- Previous Thread: HTTP Auth (.htpasswd) Not Working In CGI-BIN
- Next Thread: First openSUSE Community Week Starts Monday
| Thread Tools | Search this Thread |
.net apache asus bbc bluegene centos cisco citrix cloud cloudcomputing datacenters debian dell desktops development distributions distros drivers economy eeepc energy enterprise fedora gadgets gentoo gos government gpl hardware hp hyper-v ibm java jobs kindle knoppix kvm laptop laptops lawsuits licensing limo linustorvalds linux linuxfoundation linuxmagazine magazines microserver microsoft mobile mobilephones motorola netbook netbooks news novell olpc open openmoko openoffice opensolaris opensource opensuse openvz operatingsystems os patents pc pcworld plathome politics print qumranet redhat rhel robot russia sco server servers slackware software solaris source sun supercomputer support tivo torvalds training tv ubuntu umpc unix virtualization vmware windows x86 xandros xen





