Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2021-02-05 15:45:42

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,548
Website

Re: [SOLVED] 301s

That looks very cool!!! I’ll report back.


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#14 2021-02-09 15:56:40

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,548
Website

Re: [SOLVED] 301s

Just to report that Oleg’s suggestion worked wonderfully!!!

Sample url: https://www.neme.org/82/why-have-there-been-no-great-net-artists

Just in case anyone may need this feature here is the code in github and the htaccess which still needs a lot of work.

Thanks so much to all for your advice.


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#15 2021-02-09 17:10:24

etc
Developer
Registered: 2010-11-11
Posts: 4,189
Website

Re: [SOLVED] 301s

colak wrote #328679:

Sample url: https://www.neme.org/82/why-have-there-been-no-great-net-artists

If the problem is to redirect /id/title URLs (that you don’t use any more) to /texts/title, you should certainly be able to automate it (untested):

RedirectMatch 301 /(\d+)/([\w\-]+)$ /tests/$2?redirected=1

Offline

#16 2021-02-09 18:11:34

etc
Developer
Registered: 2010-11-11
Posts: 4,189
Website

Re: [SOLVED] 301s

You could even handle it in error_404 (or error_default):

<txp:evaluate query='<txp:page_url type="0" />=2 and <txp:page_url type="1" escape="integer" />>0'>
    Please update your <txp:permlink id='<txp:page_url type="1" />'>bookmark</txp:permlink>.
</txp:evaluate>

Offline

#17 2021-02-10 05:56:54

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,548
Website

Re: [SOLVED] 301s

etc wrote #328682:

If the problem is to redirect /id/title URLs (that you don’t use any more) to /texts/title, you should certainly be able to automate it (untested):

RedirectMatch 301 /(\d+)/([\w\-]+)$ /tests/$2?redirected=1...

That actually does the job! and saves a lot of htaccess space.

etc wrote #328688:

You could even handle it in error_404 (or error_default):

<txp:evaluate query='<txp:page_url type="0" />=2 and <txp:page_url type="1" escape="integer" />>0'>...

I was actually initially thinking of that but it is either directing them to the right page or having an intermediate one. Opted to save them a click:)

Thanks so much for your help. I think it is now solved.


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB