Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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