Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-10-13 17:49:49

alivato
Member
Registered: 2011-03-31
Posts: 151

How to redirect www to non-www

How to hide www (redirect)

http://www.site.com

http://site.com

Offline

#2 2014-10-13 18:51:48

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: How to redirect www to non-www

I did so

.htaccess

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

Is this normal?

.htaccess fully

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
#ErrorDocument 403 default
<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/	
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
	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}]
</IfModule>
#php_value register_globals 0
# SVG
AddType image/svg+xml  svg svgz
AddEncoding gzip       svgz

Last edited by alivato (2014-10-13 18:55:06)

Offline

#3 2014-10-13 19:33:34

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: How to redirect www to non-www

Looks normal.

Offline

Board footer

Powered by FluxBB