Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-09-11 21:56:06

oliverker
Plugin Author
From: Huddersfield
Registered: 2008-07-14
Posts: 90
Website

301 redirects to direct www.

Can I implement this (bellow) on the standard textpattern .htaccess file?

I have tried just putting it underneath the standard code but doesn’t work.

—————————
If you need to redirect http://mysite.com to
http://www.mysite.com and you’ve got mod_rewrite enabled on
your server you can put this in your .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]

or this:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
———————

(there are also a few

redirect 301 /index.html http://www.domain.com/index.html

redirects on the this .htaccess file)

The problem is that the are x amount of inbound links to www.domain.com and x amount of inbound links to domain.com and need all inbound links to go to the www.domain.com using redirect 301?

Thanks

Last edited by oliverker (2008-09-11 21:58:21)

Offline

#2 2008-09-11 22:08:48

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

Re: 301 redirects to direct www.

Put the rewrite rule before Textpattern’s lines to the top of your .htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Offline

#3 2008-09-11 22:20:31

oliverker
Plugin Author
From: Huddersfield
Registered: 2008-07-14
Posts: 90
Website

Re: 301 redirects to direct www.

Thanks for speedy reply, thats why I love textpattern even more, you are an excellent advocate for it.
Looks like it is working.

Offline

Board footer

Powered by FluxBB