Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Redirect from section to article
Hi,
I got a question. Let’s say my txp static site is build like: /section/article. What I want to achieve is if someone goes to www.mysite.com/section1/ he automaticly is redirected to a certain article in that section. For instance I go to www.mysite.com/section2/ that he is being redirected to www.mysite.com/section2/article2/. EDIT
Example code:
<txp:if_section name=“section1”>
<txp:go_to article name=“article2”>
</txp:if_section>
Now I know the tag <txp:go_to> doesn’t exist, but there must be someway to achieve this. Thanks on your thoughts!
Last edited by nejra (2007-03-12 22:44:38)
Offline
Re: Redirect from section to article
I use something like you want my about
section:
Use Uses permanent link mode: section/title
Creating a page about
and a section about
. Make sure that section about
uses page about
.
Create an article imprint
within section about
. For example this article has ID = 52.
If you uses this construct:
<txp:if_article_list>
<txp:article id='52'/>
<txp:else/>
<txp:article limit='1'/>
</txp:if_article_list>
instead of <txp:article/>
, you will get
http://your-site.tld/about
-> Showing up article ID 52
http://your.site.tld/about/my-plugins
Showing up article with url-title my-plugins
Offline
Re: Redirect from section to article
You could do that by hand using Apache rewrite rule, or using the Redirect Pro plugin. The plugin way is safer and simpler.
Offline
Re: Redirect from section to article
Redirect Pro seems the nicest way, but since I don’t have a paypal account (no cc here) it is useless to me. I do have iDeal (another online pay solution). That’s a shame…
I’ll try out Bastians code!
Thanks…
Offline
Re: Redirect from section to article
You could always send a bottle of Bourgogne 1995 to Alex. That might work :-)
Last edited by Jeremie (2007-03-12 23:12:42)
Offline
Re: Redirect from section to article
It probably would. But that sounds a lot more expensive than $15 (€11) ;). I’m gonna ask my mate to transfer the money I think. It seems a very powerful plugin…
Offline
#7 2007-03-13 08:35:55
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: Redirect from section to article
Here is what I do. Any article you want to be the main one for a section just set it to sticky…
<txp:if_article_list>
<txp:article limit="1" status="5" />
<txp:else/>
<txp:article />
</txp:if_article_list>
Offline
Re: Redirect from section to article
Thanks, but i dont need to display the article. I need to redirect to the article so the url is correctly viewed in the browser.
I have a couple of sections filled with articles and is no need to show the sections just the articles.
Offline
Re: Redirect from section to article
maybe this can be realized in a more elegant way but this does the trick for me:
<txp:glx_if_section_frontpage> <txp:asy_wondertag><txp:zem_redirect to="<txp:article form="url" limit="1" />" /></txp:asy_wondertag> <txp:else /> <txp:article limit="10" /> </txp:glx_if_section_frontpage>
and the form url
contains
<txp:permlink />
Offline
Re: Redirect from section to article
Jeremie
I’ve bought the plugin. Now i have a problem. When I go to the section i transfer to the article, but when viewing the article it still tries to go to the url ive given! Anyway to solve this?
Offline
Re: Redirect from section to article
I don’t understand.
You want www.mysite.com/section2/ to redirect to www.mysite.com/section2/article2
In section2’s page (template), just add this tag:
<txp:zem_redirect to="/section2/article2" />
If you don’t have a specific page for section2 but a global one, you might want to try this:
<txp:zem_redirect from="/section2/" to="/section2/article2" />
Offline
Re: Redirect from section to article
Yeah, I have a global one. I have a new problem. View this site. When you hit “systeemplafonds” (a a section you are being redirected to http://klanten.urlremoved.nl/bosma2/systeemplafonds/ARMSTRONGARMSTRONG instead of http://klanten.urlremoved.nl/bosma2/systeemplafonds/ARMSTRONG.
I use this code:
<txp:if_section name="plafonds">
<txp:zem_redirect from="/plafonds/" to="/plafonds/test123" />
</txp:if_section>
When i use a absolute path (with the http://blabla) firefox tells me there is an infinite loop.
Any thoughts? Cheers!
Edit: url removed
Last edited by nejra (2009-09-29 14:41:06)
Offline