Closed austinlangdon closed 4 years ago
Example of 301 redirects within a .htaccess file:
<IfModule mod_rewrite.c>
RewriteRule ^terms$ /legal [R=301,L]
RewriteRule ^the-simple-answer-to-what-search-engine-marketing-is-and-how-it-can-help-your-business/$ /what-is-search-engine-marketing/ [R=301,L]
RewriteRule ^seo-tips-2017/$ /seo-tips-2019/ [R=301,L]
</IfModule>
The function would check and see these 3 rules in .htaccess, and then PUT 3 more objects into S3 bucket with the x-amz-website-redirect-location
set.
Noting here that #20 addresses this. However, I think the redirect detection functionality should be in core WP2Static.
@john-shaffer thanks. Maulik works on my team and I asked him to work on this and also to create a PR.
I agree it makes sense to put detection in core. @leonstafford would you be open to letting us implement this in core? Or are you already working on it?
@austinlangdon, sorry I missed this one. Should be addressed in comment on https://github.com/WP2Static/wp2static-addon-s3/pull/20
Problem: 301 redirect rules (defined in .htaccess) are not supported/included in automated S3 deployment scope, even though S3 has support for redirects.
Proposal: Add an optional feature that if enabled, fires at the end of the S3 deployment job to setup "redirect pages" in S3 bucket.
x-amz-website-redirect-location
header set as the Target URLFor example, if a website has rule to 301 redirect
/page1/
to/page2/
, the deployment job would detect this rule, and upload a zero-byte object named/page1/index.html
with thex-amz-website-redirect-location
header value set as/page2/index.html
.Official AWS Documentation on this header: https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html