Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-10-07 00:45:32

curiouz
Member
Registered: 2006-06-20
Posts: 56

Remove www from URL

I found a rewrite rule to accomplish this, but I had no luck in combining it with the txp htaccess.

So… how do I combine this:

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

with this:

<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /

	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d

	RewriteRule ^(.+) - [PT,L]
	RewriteRule ^(.*) index.php

	RewriteCond %{HTTP:Authorization}  !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

</IfModule>

<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

Last edited by curiouz (2008-10-07 00:45:47)

Offline

#2 2008-10-07 01:37:38

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Remove www from URL

Have you tried this?

<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
	RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

	RewriteBase /

	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d

	RewriteRule ^(.+) - [PT,L]
	RewriteRule ^(.*) index.php

	RewriteCond %{HTTP:Authorization}  !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

</IfModule>

<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

Offline

#3 2008-10-07 13:30:37

curiouz
Member
Registered: 2006-06-20
Posts: 56

Re: Remove www from URL

Works great! Thanks a lot!

Offline

Board footer

Powered by FluxBB