I have a problem, I have many url attachments with / amp, example:
siteweb/article-2019/image2/amp
siteweb/article-2019/image3/amp
siteweb/article-2019/image4/amp
all these give me 404 error But the original url and where the images are are like this
siteweb/article-2019/image2/
siteweb/article-2019/image3/
siteweb/article-2019/image4/
Any way to do it with htacces?
I have a problem, I have many url attachments with / amp, example:
siteweb/article-2019/image2/amp
siteweb/article-2019/image3/amp
siteweb/article-2019/image4/amp
all these give me 404 error But the original url and where the images are are like this
siteweb/article-2019/image2/
siteweb/article-2019/image3/
siteweb/article-2019/image4/
Any way to do it with htacces?
Share Improve this question asked Jan 20, 2020 at 19:52 Plantas y remedios CaserosPlantas y remedios Caseros 33 bronze badges 1 |1 Answer
Reset to default 0Try something like the following at the top of your .htaccess
file, before the WordPress front-controller:
RewriteRule (.+/)amp$ /$1 [R,L]
This redirects a request for /<something>/amp
to /<something/
- removing the "amp" suffix.
Note that this is a 302 (temporary) redirect.
attachment.php
doesn't determine what gets shown, what gets shown determines the template, by the time WP tries to figure out which template to show, it's already fetched the posts. I'd suggest reporting this bug to the vendor that implements your Amp support ( and asking them to support attachment pages in Amp ) – Tom J Nowell ♦ Commented Jan 20, 2020 at 20:29