Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-08-03 01:34:55

mattmikulla
Member
From: Nashville Tennessee
Registered: 2004-08-25
Posts: 281
Website

Edit .htaccess file to point to non www url

What is the proper and clean way to edit the .htaccess file to point only to the non www url of my my site – mysite.com

#DirectoryIndex index.php index.html

#Options +FollowSymLinks
#Options -Indexes

<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/

	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

Changed bq. to bc. -Gocom

Last edited by Gocom (2010-08-03 03:36:19)


Art Rogue – Fine Art Photography

Offline

#2 2010-08-03 03:40:18

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Edit .htaccess file to point to non www url

There are multiple conditionals, or let’s say ways, you can use to redirect from subdomain to non-subdomain URI. You should be using the method that works on your server.

Usually you would be placing the redirection snippet to right after RewriteEngine On line.

To do the actual redirection, for example I use:

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

Offline

Board footer

Powered by FluxBB