Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-09 05:35:46

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

How do I force "www." with .htaccess?

I’d like to force the inclusion of “www.” at the beginning of all URLs on a Txp site I’ve just finished, redirecting visitors who don’t type it before the domain name. For my WordPress-powered weblog, I’m using the following lines in .htaccess, but they produce errors when used with Textpattern:

<pre><code>RewriteCond %{HTTP_HOST} ^adammessinger.com$ [NC]
RewriteRule ^(.*)$ http://www.adammessinger.com/$1 [R=301,L]</code></pre>

The .htaccess syntax is a complete mystery to me. Any advice?

Offline

#2 2006-03-09 05:56:17

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: How do I force "www." with .htaccess?

What sorts of errors are they producing? Your syntax looks correct. One thing to note, make sure you’re placing those lines before your Textpattern rules (but after “RewriteEngine On”) in the .htaccess file.

Last edited by Andrew (2006-03-09 05:57:15)

Offline

#3 2006-03-09 06:08:39

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: How do I force "www." with .htaccess?

The problem seems to have been that the www re-direct statements were after the standard Txp statements rather than before.

Thanks for the fix, Andrew.

Offline

Board footer

Powered by FluxBB