This is a part of Cloage’s Knowledge Base. If you need more info on other subjects, simply check out our documentation here.
This guide summarizes the steps you need to take to install and configure the WP Offload Media plugin (premium version).
Make your S3 Compatible Partition
Install the premium version of the WP Offload Media plugin and install the plugin adapter
Send us a request (new ticket) from the support section and we’ll send you the link to the premium version of the WP Offload Media plugin and its compatibility plugin. After installing the plugin, you need to send your WordPress admin access to our support experts to activate the plugin license for you. With a message encryption tool like this, send us the admin panel address and password of your WordPress admin password.
Next, to connect WordPress and the plugin to the S3 partition, you must enter the following code in your WordPress wp-config.php file:
define( 'AS3CF_SETTINGS', serialize( array( 'provider' => 'aws', 'access-key-id' => 'YOUR ACCESS KEY', 'secret-access-key' => 'YOUR SECRET KEY', 'endpoint' => 'YOUR ENDPOINT', ) ) );
Copy your private key and access key and endpoint address from the partition information section in the Cloage dashboard and paste it in the code above. If you do not know how to get your SECRET KEY, ACCESS KEY and ENDPOINT, see the S3 Partition Guide.
Important Note: The above code must be placed above these lines in the wp-config.php file, otherwise the code will not be read and won’t function as intended.
Another Important Note: Put the endpoint address in the code without HTTPS.
Build a bucket on the S3 partition and set up a bucket for media files
After installing and setting up the plugin and setting the access key and private key, you must introduce a bucket in the plugin settings section:
In this section, you can choose from the buckets that were previously created on your S3 partition or create a new bucket. Note that your files on the S3 partition are in private mode, while the files in the WordPress media section must be public. So before you select or create a bucket in the image above, follow these steps:
- Enter the S3 partition endpoint address in your browser’s bar address to open the S3 (Minio web client) web panel. Log in to the web panel using the access key and the private key. And make a bucket using the button.
- After creating the bucket, in the left menu of the web panel of S3 partition, you will see the list of created buckets. Click on the menu in front of the bucket you created and select the Edit Policy option.
In the Edit Policy window, in the /wp-content add a Read-Only policy path. This way, the files in this path will be public. Now go back to your WordPress dashboard in the WP Offload Media plugin settings section, go to the Media tab and select the bucket you created from the list of buckets. Now any file you upload to your WordPress library, posts, etc. via the Add Media Multimedia Buttons will be stored on your S3 partition.
Set your domain to S3 partition
You must have noticed that your endpoint address is a long URL and your media links are too long and this may not be good for your site’s SEO. Just set your subdomain to S3 partition and use the subdomain address of your main site instead of endpoint. To do this, just consider a subdomain like S3.yourdomain.com and go to the DNS management section of your main site hosting service panel and create a CNAME record. The value you need to enter for your CNAME record varies according to the geographical location of your S3 partition. Is:
To set the subdomain on the S3 partition with a European location, just define a CNAME record with the value cname.c3.cloage.com in the DNS management section of your main site hosting service panel. If you do not know how to set a CNAME record, read the subdomain setting guide on the partition here.
Addressing for WooCommerce and EDD
Files that you upload to the WooCommerce and EDD file stores should not be public, so it is best not to upload them to the WordPress media section and not to the /wp-content directory. For this purpose, create a new path (a folder) outside your wp-content path in your root bucket.
Create a new path in the bucket you created for WordPress using the Create New path option, And upload your file (for example test.zip file).
After uploading, go to the product editing section and define the file path in the downloaded product address field as follows:
[amazon_s3 bucket=mybucket object=path/to/my/file.zip]