URL Rewrite to remove file extension
Hi,
Can someone help me make a URL rewrite expression that removes file extension?
Example:
URI path in:
/aaa/bbb.png
URI out: /aaa/bbb
(which shows bbb.html
)
The tricky thing is I don't have the premium stuff like regex9 Replies
That is something typically done at the origin server. You might cause issues if trying to modify it via cloudflare
I am using cloudflare pages, and this is a rule that applies to only some traffic
Pages typically hides the extensions but it also depends on the framework you are using to build your site
well, i mean, i want the file (like an image) to redirect to the page it is hosted on
? That's not how HTML works. You can hyperlink the image to a page but you can't serve content and have it redirect
maybe worth using a worker on your path and scripting some logic to modify the request based on route
using worker you could leverage regex and path match with regex how you are asking
hmm maybe
isnt that exactly what tenor does with gifs on discord though?
I believe Tenor is detecting likely-human browser user agents and doing it that way?
But also yeah you may be able to achieve this with meta tags too
Also I guess beware this tends to really annoy power users
i was using AS numbers on cloudflare but idk