Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-11-13 19:22:38

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Redirect www to no www

A bit late, but could you try the rules in this order:

RewriteEngine On
RewriteBase /

# 301 redirect to domain without 'www.'
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^/(.*)$ http://domain.com/$1 [R=301]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization}  !^$
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

The redirect from www to non-www comes first, and also, I’ve removed the [L] flag (‘L’ stands for ‘Last’), so the following rules should be processed too.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#14 2010-11-13 19:39:44

element
Member
Registered: 2009-11-18
Posts: 99

Re: Redirect www to no www

Above works too, even with [L] flag

Offline

#15 2015-05-18 15:41:06

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: Redirect www to no www

Can I do a (surely) stupid question?
How is possible that TXP mysite.it and www.mysite.it are different?!?
I’m tryin’ to re-open a TXP site (that I’ve abandoned years ago and now I can’t remember what I set…).
Can you give me a suggest where to look at?
Many thanks…

Offline

#16 2015-05-18 16:31:11

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: Redirect www to no www

The different page was a customized error_503 page (that I was forgotten and wasn’t as a 503 should be).
Turned off smd_at_work and all was clear.
I must start to comment all my code customizations… :|

Offline

Board footer

Powered by FluxBB