Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-08-26 08:00:25

johnnie
Member
Registered: 2007-03-10
Posts: 58

redirect site.com to www.site.com

Hello,

My txp-site has fallen prey to a canonical URL-issue (the site.com vs www.site.com) with google. To fix this, I want to add the following lines to .htaccess:

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

However, this results in the following URL string: http://www.vakantie-zuidafrika.nl/index.php/

Which is obviously wrong.

How do I fix this?

Last edited by johnnie (2008-08-26 08:01:05)

Offline

#2 2008-08-26 08:13:15

johnnie
Member
Registered: 2007-03-10
Posts: 58

Re: redirect site.com to www.site.com

Never mind! Problem solved. For those interested, the htaccess now looks like this:

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/
	RewriteCond %{HTTP_HOST} ^vakantie-zuidafrika\.nl$ [NC]
	RewriteRule ^(.*)$ http://www.vakantie-zuidafrika.nl/$1 [R=301,L]
	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^(.+) - [PT,L]
	RewriteRule ^(.*) index.php
RewriteCond %{HTTP:Authorization} !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
#php_value register_globals 0

Last edited by johnnie (2008-08-26 08:13:30)

Offline

#3 2008-08-27 22:43:33

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: redirect site.com to www.site.com

Could anybody tell me what I’m doing wrong?

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
<IfModule mod_rewrite.c>
        RewriteEngine On
        #RewriteBase /relative/web/path/
        RewriteCond %{HTTP_HOST} ^judithinglese\.com$ [NC]
        RewriteRule ^(.*)$ http://www.judithinglese.com/$1 [R=301,L]
        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^(.+) - [PT,L]
        RewriteRule ^(.*) index.php
        RewriteCond %{HTTP:Authorization} !^$
        RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
#php_value register_globals 0

Last edited by JanDW (2008-08-27 22:44:57)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#4 2008-08-27 23:21:42

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: redirect site.com to www.site.com

Try replacing the line

RewriteCond %{HTTP_HOST} ^judithinglese\.com$ [NC]

with

RewriteCond %{HTTP_HOST} ^judithinglese.com$ [NC]

Offline

#5 2008-08-28 01:08:05

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: redirect site.com to www.site.com

Thanks for your reply, Joe. However, it’s not resolved yet.

I’ve also tried:

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

Last edited by JanDW (2008-08-28 01:20:20)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#6 2008-08-28 02:21:32

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

Re: redirect site.com to www.site.com

Try before Textpattern’s rules:

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

Offline

#7 2008-08-28 04:45:00

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: redirect site.com to www.site.com

Thanks, Gocom. Alas that doesn’t change anything either.
In a moment of frustration, after I threw my pet hampster into the wall, I removed the .htaccess file, and found that textpattern was still operating in clean URL mode. Is that even possible? Or does textpattern not depend on .htaccess for that? the .htaccess file is in the root dir of my site.

I just realize I don’t have a hampster, hmmm, maybe that was last month’s tiramisu…

Last edited by JanDW (2008-08-28 05:08:02)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#8 2008-08-28 05:05:17

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: redirect site.com to www.site.com

Odd to think that you may have had a hampster as a pet, most folks put a picnic in their’s :-).

I wonder if you are not succeeding in overwriting/deleting the existing .htaccess file on the host because of a permissions problem or something similar. That would account for the stubborn behaviour and the apparently persistent clean URLs.

If that isn’t the case, I think that the best way forward for you is to swallow some pride, but not the elderly tiramisu, and seek the assistance of your Host. The amendment I suggested above, set into the code you showed, works fine for me on a bunch of TXP sites.

Offline

#9 2008-08-28 17:32:37

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: redirect site.com to www.site.com

Ok, this is embarrasing. I put the file in the wrong directory. Apparently my head is filled with month old tiramisu as well.
Great first post! Hope I made a good impression! I realized it just a minute into my chat with the help desk.
nice! Well, I’m off to the pet store to buy myself a bucket of ham(p)sters, hopefully that will help me to relax a bit. O, ham(p)ster, you elusive animal! Why can you be spelled two different ways?

Thanks again for your time, Joe & Gocom.

Last edited by JanDW (2008-08-28 17:58:23)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#10 2008-08-28 18:25:36

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: redirect site.com to www.site.com

Don’t worry about it Jan. When I do things like that, my wife howls with laughter and then ridicules me for days afterwards. It’s a good looking site and well worth the pain.

Offline

#11 2008-08-28 19:31:55

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: redirect site.com to www.site.com

Thanks, Joe. Sounds like a good sort of wife :-)

Last edited by JanDW (2008-08-28 19:36:28)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

Board footer

Powered by FluxBB