Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-02-17 23:25:49
- babyben
- Member
- Registered: 2007-06-03
- Posts: 39
htaccess - www to non-www. or vice versa
I’m trying to correct traffic to my TXP site, using either www.domain.ext, or simply domain.ext but I can’t get the .htaccess to play ball. I’ve edited my usual htaccess but I’m getting very odd redirects, not the pages I request. I’ve searched but couldn’t find a Textpattern answer.
#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] RewriteRule ^(.*) index.php RewriteCond %{HTTP:Authorization} !^$ RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}] RewriteCond %{HTTP_HOST} ^www\.domain\.ext$ [NC] RewriteRule ^(.*)$ http://domain.ext/$1 [R=301,L] </IfModule> #php_value register_globals 0
Offline
Offline
Re: htaccess - www to non-www. or vice versa
Or if you want the www you can try this:
RewriteEngine On
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
SecFilterEngine Off
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yoursite\.tld$
RewriteRule (.*) http://www.yoursite.tld/$1 [R=301,L]
#RewriteBase /relative/web/path/
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php
</IfModule>
#php_value register_globals 0
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#4 2008-02-18 16:19:16
- babyben
- Member
- Registered: 2007-06-03
- Posts: 39
Re: htaccess - www to non-www. or vice versa
Brilliant, exactly what I was looking for. Thank you both.
Offline