Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-01-05 10:41:17

maxvoltar
Member
From: Machelen, Belgium
Registered: 2007-08-16
Posts: 76
Website

Re: Rewrite rule for subdomain.domain.com/anything => domain.com/anything

graeme your solution gives me URL’s like this: http://subdomain.domain.com/index.php/string, not sure what the problem is…

Els: Thanks, that works great, but there’s one problem: My subdomain is actually a folder of the root, so it pulls in 2 .htaccess files, which causes infinite redirection. I tried changing it to this:

Redirect 301 http://domain.com/articles http://subdomain.domain.com/articles
Redirect 301 http://domain.com/notes http://subdomain.domain.com/notes

…but that didn’t really work out as planned… Any way of saying “if domain.com/articles or www.domain.com/articles go to subdomain.domain.com/articles”?


Textpattern projects: Maxvoltar, Made by Elephant, Twunch

Offline

#14 2010-01-05 17:55:40

graeme
Plugin Author
Registered: 2004-06-21
Posts: 337
Website

Re: Rewrite rule for subdomain.domain.com/anything => domain.com/anything

maxvoltar wrote:

graeme your solution gives me URL’s like this: http://subdomain.domain.com/index.php/string, not sure what the problem is…

Probably interference from txp’s .htaccess rewrite rules – try putting the lines above RewriteCond %{REQUEST_FILENAME} -f [OR].

Last edited by graeme (2010-01-05 17:58:23)

Offline

#15 2010-01-05 17:56:29

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Rewrite rule for subdomain.domain.com/anything => domain.com/anything

maxvoltar wrote:

My subdomain is actually a folder of the root,

Not sure if I understand the problem correctly, but what happens if you add this before the other lines:

Redirect 301 /subdomain http://subdomain.domain.com

or maybe this in the /subdomain/ folder:

Redirect 301 / http://subdomain.domain.com

Offline

#16 2010-01-05 23:15:15

maxvoltar
Member
From: Machelen, Belgium
Registered: 2007-08-16
Posts: 76
Website

Re: Rewrite rule for subdomain.domain.com/anything => domain.com/anything

Els: I get this message in both cases:

Too many redirects occurred trying to open “http://2009.maxvoltar.com/articles/url-abc”. This might occur if you open a page that is redirected to open another page which then is redirected to open the original page.

Graeme: Thanks a lot, putting your snippet of code above RewriteCond %{REQUEST_FILENAME} -f [OR] made it work! Go to http://maxvoltar.com/articles/the-broken-watch for a test!

Thanks all :)

Last edited by maxvoltar (2010-01-05 23:15:57)


Textpattern projects: Maxvoltar, Made by Elephant, Twunch

Offline

#17 2010-01-05 23:17:34

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Rewrite rule for subdomain.domain.com/anything => domain.com/anything

Well, that’s one answer to my question: Graeme’s rule works in your special case and mine doesn’t ;)

Offline

Board footer

Powered by FluxBB