Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-12-08 02:35:45

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,453

Redirect one download link to another

I am trying to redirect with .htaccess one download link to another, but it doesn’t work.

 Redirect 301	/file_download/1/title.pdf	https://domain.tld/file_download/13/title.pdf

or…

RedirectMatch 301	/file_download/1/title.pdf	/file_download/13/title.pdf

Does anyone have an idea why this isn’t redirected?

Offline

#2 2020-12-09 01:28:21

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,230
Website

Re: Redirect one download link to another

I have it working with RedirectMatch 301. What is happening on your side ?


Where is that emoji for a solar powered submarine when you need it ?

Offline

#3 2020-12-09 03:34:45

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,453

Re: Redirect one download link to another

It works with article or section URLs, but not with /file_download/.

Offline

#4 2020-12-09 06:43:48

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,230
Website

Re: Redirect one download link to another

That is strange, it works perfectly here. Maybe try omitting the file-name.ext, like this:

  Redirect 301	/file_download/1/title.pdf	https://domain.tld/file_download/13/

Otherwise I have no clue.


Where is that emoji for a solar powered submarine when you need it ?

Offline

#5 2020-12-09 09:27:09

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,026
Website

Re: Redirect one download link to another

Where do you have it in your .htaccess file? As far as I remember it should be before Textpattern does any other handling of files, e.g. above the REQUEST_FILENAME and after the Rewrite Base, e.g. here.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2020-12-09 17:22:24

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,453

Re: Redirect one download link to another

I thought “that’s it, jakob always makes good suggestions”. But unfortunately that doesn’t work either.

Offline

#7 2020-12-09 18:30:26

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

Re: Redirect one download link to another

Is the direct access to the replacing file working at all?

Online

#8 2020-12-10 01:52:39

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,453

Re: Redirect one download link to another

Yes, there are two files with working, direct download. But I want file #1 not to be downloaded anymore, but file #11 in its place.

There are people who still have the old link for a file with date without knowing that there is a newer version of the file that has no date in the link, but is always up-to-date.

Offline

#9 2020-12-10 04:57:46

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

Re: Redirect one download link to another

It would have been much simpler to replace the file (similar to the way images are replaced), but I remember that this is an issue with txp for some years now. I’m not sure if it was fixed since OK, I eventually did see your post in the forum. .

Last edited by colak (2020-12-10 05:12:04)


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