remove www on https://

New to mod_rewrite? This is a good place to start.

remove www on https://

Postby rsleventhal » Fri Jul 15, 2011 4:54 am

Hi,

I've searched the forums and tried some things, but I can't seem to get this to work.

I need to remove the www whenever there's an https:// call. How would this be accomplished via .htaccess and mod_rewrite?

I tried these, but I can't seem to get the desired results

Code: Select all
RewriteCond %{HTTP_HOST} ^www.domain.com [nocase]
RewriteRule ^(.*) https://domain.com/$1 [last,redirect=301]


Code: Select all
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*) https://domains.com/$1 [R=301,L]

Thanks in advance for any ideas.

-Ray
rsleventhal
 
Posts: 15
Joined: Thu May 15, 2008 7:17 am

Re: remove www on https://

Postby TeckniX » Mon Dec 12, 2011 9:50 am

Try this:
Code: Select all
RewriteCond %{ENV:HTTPS} on [NC]
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [L,R=301]
TeckniX
 
Posts: 38
Joined: Tue Mar 27, 2007 12:18 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron