Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: To link "write title" directly to offsite URL..
A trace by HTTP Live Headers might help to see what get through to the client end.
Offline
Re: To link "write title" directly to offsite URL..
Hmpff…!?
- Turned asy_jpcache off
Used code (+ 301. , + exit):
<txp:if_individual_article>
<notextile>
<txp:php>
header('Location: http://sankt-georg.info/tag/bunte-lange-reihe',TRUE,301);
exit;
</txp:php>
</notextile>
</txp:if_individual_article>
Even forcing the permanent redirect with the 301 returns just a 200 and the message “OK The document has moved here” but no redirect.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>200 OK</TITLE>
</HEAD><BODY>
<H1>OK</H1>
The document has moved <A HREF="http://sankt-georg.info/tag/bunte-lange-reihe">here</A>.<P>
</BODY></HTML>
The header sent back laconically says:
HTTP/1.x 200 OK
Date: Sun, 13 Apr 2008 12:29:26 GMT
Server: Apache/1.3.34 Ben-SSL/1.55
Cache-Control: no-cache
X-Powered-By: PHP/4.4.8
Location: http://sankt-georg.info/tag/bunte-lange-reihe
Keep-Alive: timeout=2, max=199
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
Does it look like an ISP issue?
I have to check my dashboard at ’1&1 Germany’. Maybe they do redirects only from the slow admin console (arghh).
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
Re: To link "write title" directly to offsite URL..
It could either be a server issue, or some misbehaving redirector plugin. As far as I can see, it is off-topic in this thread.
Offline
Re: To link "write title" directly to offsite URL..
it is off-topic in this thread.
Yep. Confirm. Will check myself what is happening. Thanks for your patience.
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
#20 2008-04-14 11:30:54
- SebastianS
- Member
- From: Australia
- Registered: 2007-10-05
- Posts: 46
Re: To link "write title" directly to offsite URL..
Jukka,
“Sebastian, not to the body itself, instead use the specific form, it’s much easier. The custom field launches the code, so no need to use the actual body.”
Just to confirm what I did:-
Using either Roberts code or your code, both codes work, and placing either into “Presentation/Forms”, calling the form article_url, and saving it as a “Type/Article.
I then went Content/Write and placed the url of the header I wanted to use in the article_url custom field I had made in Admin/Preferences/Advanced.
To make header perform the way I wanted I put a <txp:output_form form=“article_url” /> form in the article body, without using this output form, the header link does not link to the chosen URL but links back within the “local” website.
Thanks again for your replies.
Offline
Re: To link "write title" directly to offsite URL..
SebastianS wrote:
To make header perform the way I wanted I put a <txp:output_form form=“article_url” /> form in the article body, without using this output form, the header link does not link to the chosen URL but links back within the “local” website.
You can put the <txp:output_form form="article_url" /> to your form that you use for those specific articles, in example to your form called default. Then it will automatically redirect when you have filled the custom_field and you don’t need to place the extra, and somwhat useless code to the body. You can also place the code directly to the specific article form, in example default, without the output_form. That way it also reduces the amount of queries.
Last edited by Gocom (2008-04-14 11:47:13)
Offline
Re: To link "write title" directly to offsite URL..
wet wrote:
It could either be a server issue, or some misbehaving redirector plugin. As far as I can see, it is off-topic in this thread.
i hate to revive this thread and becoming off-topic again, but i’m having the exact same issues as markus and am pretty much clueless on how this can be solved. i’ve inserted wet’s aforementioned codesnippet in an articles body and instead of being redirected, i’m getting a “200 OK” from the server and the usual “The document has moved here” message. where should i start fixing this?
Offline
Re: To link "write title" directly to offsite URL..
As PHP versions below below 4.3.0 won’t transmit the HTTP status set via the header() function, it might help to explicitly specify the HTTP response status with a little more insistence.
Try this:
<txp:if_individual_article>
<notextile>
<txp:php>
txp_status_header('301 Moved Permanently');
header('Location: http://example.com/');
exit;
</txp:php>
</notextile>
</txp:if_individual_article>
Offline
Re: To link "write title" directly to offsite URL..
wet. you are my hero. thank you so much, works like a charm.
Offline
Re: To link "write title" directly to offsite URL..
wet. you are my hero. thank you so much, works like a charm.
Vote +1 :)
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
Re: To link "write title" directly to offsite URL..
Could you not achieve this with zem_redirect pro?
For example, for a specific page:
<txp:zem_redirect to="/section" from="/section/article-name" /><!DOCTYPE html>...
… and for all pages of a section:
<txp:zem_redirect to="/section" from="/section/(.+)" /><!DOCTYPE html>...
BTW: if my regexp is not ideal, or if zem_redirect has a better built-in wildcard placeholder I don’t know about, I’d be very grateful for a tip.
TXP Builders – finely-crafted code, design and txp
Offline