Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
[solved] redirect 301 throws 500
In the new imca site I have 2 articles which are live but I only want them to appear on their sections and the search results.
The problem is with the search results where the articles appear with their urls. What I am trying to do is to rewrite their individual urls to the section ones.
I have tried
#RewriteEngine On
#RewriteRule ^/about/about-the-imca$ /about/
#RewriteRule ^/workshops/workshops$ /workshops/
which did not work
and
#Redirect 301 /about/about-the-imca /about/
#Redirect 301 /workshops/workshops /workshops/
which returns a 500 error
Does anyone know how to do this?
Last edited by colak (2011-01-17 17:21:32)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: [solved] redirect 301 throws 500
The trick/workaround is to do the forced redirect when the individual article is called
I used this code for this article
Edit: I assume that your section landing page is a list.
<txp:if_individual_article>
<notextile>
<txp:php>
txp_status_header('301 Moved Permanently');
header('Location: http://sankt-georg.info/artikel/777/strassenfest-lange-reihe-bunte-lange-reihe-hamburg-st.-georg ');
exit;
</txp:php>
</notextile>
</txp:if_individual_article>
Edit II.: Oh man, reading the old thread reminds me of the headache (& time consumption) I had when I tried to solve that redirect issue. Maybe you should read the thread too and thank wet on knees for the laconic help he has to offer from time to time :)
Last edited by merz1 (2011-01-17 16:22:10)
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
Re: [solved] redirect 301 throws 500
That did it! I honestly don’t remember that thread. Thanks sooo much Markus. And kudos goes to Robert for the code of course:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: [solved] redirect 301 throws 500
I also had to search for the solution. Luckily I bookmarked the link as a tip inside my own site :)
Maybe you find the time to write a TXP wiki FAQ entry?
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
Re: [solved] redirect 301 throws 500
Hi markus
although i’m yet to contribute to the wiki, this might be a good opportunity to do so.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: [solved] redirect 301 throws 500
Good that your problem is solved. But I notice a possible syntax issue in your .htaccess.
I would I have tried
#RewriteEngine On
#RewriteRule ^about\/about-the-imca$ /about/
#RewriteRule ^workshops\/workshops$ /workshops/
(without / after ^, and with \ to escape remaining /)
Offline
Re: [solved] redirect 301 throws 500
Hi Claire
The php method works but I thought i’ll try your suggestion anyway and although it does not return a 500 it does not seem to work either
also tried
RewriteEngine On
RewriteRule ^\/about\/about-the-imca$ /about/
RewriteRule ^\/workshops\/workshops$ /workshops/
again with the same non results.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: [solved] redirect 301 throws 500
Hi Yiannis,
Claire’s suggestion seems correct to me, particularly the one about not using /
after the beginning (^
) of the line. I’ve read that several times in .htaccess documentation and tutorials.
Regarding escaping other /
in the pattern, it may help, but definitely it’s not required, as I’ve several un-escaped /
on my rewrite rules.
Finally, I’ll appreciate if you could try this version, to see if it works.
RewriteEngine On
RewriteRule ^about/about-the-imca$ /about/ [R=301,L]
RewriteRule ^workshops/workshops$ /workshops/ [R=301,L]
The [R=301,L]
flags are required for external rewrites (aka redirects). If not, I understand that you are just doing an internal rewrite.
Offline
Re: [solved] redirect 301 throws 500
Hi Julián
your suggestion works:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: [solved] redirect 301 throws 500
The flags … of course … I’m so sorry.
Thanks Julián.
Offline
Pages: 1