Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-04-16 09:06:23

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 215
Website

redirect a lot of pages

Hello all,

i need to permanent redirect a whole lot of pages on a page by page basis.
urls are in the form of /some-page?id=xy and i need to redirect to /my-new-page

I first tried to set a RewriteCond / RewriteRule in a .htaccess for each page, but apache seems to choke on it after 3 or 4 rules.

what do you think would be the best to accomplish this ?
Try some apache voodoo i don’t know about ?
Write some callback function on pretext event to analyses each url, set the right header and redirect ?

Thanks for any insight.

Offline

#2 2014-04-16 09:15:38

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

Re: redirect a lot of pages

Hi, are these redirects due to your changing the permanent link mode? If this is the case I would recommend installing zem_redirect


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

Offline

#3 2014-04-16 09:19:29

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 215
Website

Re: redirect a lot of pages

No it’s a complete overhaul of a website.
We’re switching to Textpattern from a proprietary solution and the whole architecture has been redone.

Offline

#4 2014-04-16 09:41:45

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 215
Website

Re: redirect a lot of pages

Forget my question.
Had a typo in my file :)

Anyway wandering if 20+ successive rewriterules in .htaccess is bad for performance ..

Offline

#5 2014-04-16 10:17:34

trenc
Plugin Author
From: Amsterdam
Registered: 2008-02-27
Posts: 571
Website GitHub

Re: redirect a lot of pages

planeth wrote #280269:

Anyway wandering if 20+ successive rewriterules in .htaccess is bad for performance ..

No. 20+ is managable. I’ve seen .htaccess with 300 rewrite rules and with no remarkable performance drop. But you could try to use summarized rules with regexes, if possible. And/Or – if possible too – flag each rule with the L (last), so that the mechanism stops looping through the rest of the (unused) rules.

Offline

#6 2014-04-17 13:56:24

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 215
Website

Re: redirect a lot of pages

trenc wrote #280270:

No. 20+ is managable.

Good :)

But you could try to use summarized rules with regexes, if possible.

Tried that too but very few cases are in this category

flag each rule with the L (last), so that the mechanism stops looping through the rest of the (unused) rules.

done that too

Thanks for the good advice !

Offline

Board footer

Powered by FluxBB