3 ms·
Thank you for that. Not to seem ungrateful, but I'm wary of pasting "might work" code onto my blog. What if it goes wrong? What if it has unexpected side effec
by edent 10y ago
Thank you for that. Not to seem ungrateful, but I'm wary of pasting "might work" code onto my blog.
What if it goes wrong? What if it has unexpected side effects? What if Google crawls it and makes things worse?
There are currently 3 variants of the above posted in the comments. I've no idea which to choose...
I guess I'll try and hope that it doesn't make things worse :-)
- jc4p 10y agoIt's a very understandable worry :) Writing rules that when they fail just go into server error logs is sub-optimal at best. The real solution would be Google allowing per-site AMP de-registration, but that's a fantasy I bet. This is a good article on Apache URL rewriting, if you want to go down that path: https://24ways.org/2013/url-rewriting-for-the-fearful/ https://24ways.org/2013/url-rewriting-for-the-fearful/ I believe in your use case you want to transform `all/urls/of/any/sort/that/end/in/amp/` and simply redirect to everything minus the `/amp/`, so the rewrite rule shouldn't be too bad to write (and test). I wouldn't use the "might work" in my comment since I wrote it without even seeing if the regex works, but if you get an Apache test domain running off your blog you can test the redirect rules in isolation before putting them on your blog.