Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-03-07 18:56:12

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 118
Website

.htaccess adding "www"

I have a hand-coded main site with a textpattern blog in the /blog directory. I’ve used a rewrite rule in / to force the “www” in the url. It works for all subdirectories except the /blog where I’m using the standard .htaccess provided by the indtall. I thought the directive would pass down the the /blog subdirectory, but it doesn’t seem to do that. How can I get the blog to force the use of www?

Thanks.

james

Offline

#2 2013-03-07 23:10:36

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: .htaccess adding "www"

Try adding the same rule in the htaccess file in the blog directory above the txp stuff…. haven’t tested but I think it should work

Offline

#3 2013-03-08 14:23:34

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 118
Website

Re: .htaccess adding "www"

Last time I tried that it didn’t work.

Offline

#4 2013-03-08 14:44:01

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,172
Website GitHub Mastodon Twitter

Re: .htaccess adding "www"

what do you have in the root htaccess now?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2013-03-09 00:30:29

maratnugmanov
Member
From: Russia / Kazakhstan
Registered: 2013-02-24
Posts: 54
Website

Re: .htaccess adding "www"

Have you seen WWWizer? It’s free redirect to your domain with www.
Here’s url
But I might misunderstand you, don’t blame.

Last edited by maratnugmanov (2013-03-09 00:36:41)

Offline

#6 2013-03-13 20:24:37

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 118
Website

Re: .htaccess adding "www"

In the site root I have a rewrite rule to add www to the url so that I can use CloudFlare. I was hoping that would pass down to the blog, but it doesn’t. Can I add the .htaccess from the blog to the one in the root? Would that help make all the urls www.wanderingitaly.com?

Offline

#7 2013-03-14 07:17:23

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,172
Website GitHub Mastodon Twitter

Re: .htaccess adding "www"

Try to add this in your root htaccess and do let us know the results

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

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2013-03-15 00:36:23

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 118
Website

Re: .htaccess adding "www"

That’s exactly what I have in there (as well as some catching stuff) , but you can access the blog with http://wanderingitaly.com/blog and it doesn’t redirect to www.wanderingitaly.com/blog, but it does add the www. to the files in the hand-coded part of the site just fine.

Offline

#9 2013-03-15 01:28:18

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: .htaccess adding "www"

where have you got in in the file though? I normally put all my domain rewriting above the txp stuff to make it work on my server.

I still think rewriting the permlink should have the option in the core (like I mentioned here) – but I think I’m alone on that one

Offline

#10 2013-03-15 01:36:23

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 118
Website

Re: .htaccess adding "www"

That’s the problem, I have the .htaccess in the root, then the textpattern .htaccess in the /blog directory.

Offline

#11 2013-03-15 02:22:35

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: .htaccess adding "www"

Well in the htaccess file in your blog directory – make sure it looks something like the below (which I think is the standard htaccess file) – note the comments and code below them “#Your www domain rewrite”, “# Begin txp htaccess “, “# Specify your subdomain” – let us know how you go.

#Your www domain rewrite

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

# Begin txp htaccess 

#DirectoryIndex index.php index.html

#Options +FollowSymLinks
#Options -Indexes
#ErrorDocument 403 default

<IfModule mod_rewrite.c>
	RewriteEngine On
# Specify your subdomain
	#RewriteBase /blog/

	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

# SVG
AddType image/svg+xml  svg svgz
AddEncoding gzip       svgz

Offline

#12 2013-03-15 22:03:59

jrmartin
Member
From: California | Italy
Registered: 2013-03-07
Posts: 118
Website

Re: .htaccess adding "www"

That just redirects it to the home page, www.wanderingitaly.com.

Offline

Board footer

Powered by FluxBB