Preserving Original URL
-
Hi
I am using Elastic Beanstalk for hosting my sites and I am using this plugin to persist my uploads.
I was previously using s3fs on my setup which while hosting files on S3 preserves the default wordpress URL structure for uploads. Since s3fs was slow, I decided to switch over to this plugin.
Since this plugin uses wp_get_attachment_url filter to change the attachment URLs, I will now need to go to all my posts and update URLs in use. Also, since I also use a CDN plugin (W3TC/origin pull), it will not work properly if my attachment URLs are not default. Yet another reason to keep using default URLs is that several plugins read attachment URLs from DB (which are still in default structure) and will return 404.
I was thinking of a way to preserve the original URL structure and came up with the following scheme:
1. Commenting out the following line in the plugin add_filter(‘wp_get_attachment_url’, array($this, ‘build_attachment_url’), 20, 1);
2. Using a function (in functions.php) to add a rewrite rule which rewrites uploads directory to S3 bucket URL.
3. In my setup, I really don’t have a use for the fallback option, so I can comment the following lines too:
add_action(‘init’, array($this, ‘add_images_rewrite’), 10, 0);
add_action(‘template_redirect’, array($this, ‘load_image’));The above steps will probably give me a quick fix, but I will have to keep following this plugin’s updates and incorporate my changes every time.
Is it possible to cover my requirements by adding configuration options? Maybe a “Preserve URL Structure” option …?
- The topic ‘Preserving Original URL’ is closed to new replies.