Smush Plugin Configuration in .htaccess file is not working

Keywords: WordPress Multisite - AWS - How to - Plugins installation/configuration

Description:
Tried adding Smush Plugin Configuration Code but it is not working it as .htaccess file somewhat different in Bitnami Multisite.

Smush wants me to add below mentioned code in .htaccess file for local webP conversion

# BEGIN SMUSH-WEBP
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{DOCUMENT_ROOT}/wp-content/smush-webp/disable_smush_webp !-f
 RewriteCond %{HTTP_ACCEPT} image/webp
 RewriteCond %{DOCUMENT_ROOT}/wp-content/smush-webp/$1.$2.webp -f
 RewriteRule ^/?(.+)\.(jpe?g|png)$ /wp-content/smush-webp/$1.$2.webp [NC,T=image/webp]
</IfModule>

<IfModule mod_headers.c>
 Header append Vary Accept env=WEBP_image
</IfModule>

<IfModule mod_mime.c>
 AddType image/webp .webp
</IfModule>
# END SMUSH-WEBP

If i add the code in this file /opt/bitnami/apache2/conf/vhosts/htaccess/wordpress-htaccess.conf
like this:
<Directory “/opt/bitnami/wordpress”>
# Above Code
</Directory
Then except home page no other page works, it gives no url found error.

Hi @codecraftcrew,

You followed the correct steps as per our documentation

https://docs.bitnami.com/aws/apps/wordpress/administration/use-htaccess/

However, if the application doesn’t work after applying the changes, we suggest you contact the plugin’s developers so they can investigate what’s wrong with the code they provided. The code they provide shouldn’t break the application in any case.

Thanks

Thanks @jota for replying so quick.
They already tried and said current architecture which is of Bitnami is very strange and this particular code is working their every client.
Is there any way Bitnami can debug and found some solution, i feel there could be something which needs to be done more so that all other urls doesn’t get blocked.

Hi @codecraftcrew,

Can you run the bndiagnostic tool and send me the output ID it generates?

Regards,
Michiel

Thanks for the replies, issues seems to be fixed by changing the code to this:

<Directory "/opt/bitnami/wordpress">
# BEGIN SMUSH-WEBP
<IfModule rewrite_module>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/wp-content/smush-webp/disable_smush_webp !-f
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/wp-content/smush-webp/$1.$2.webp -f
RewriteRule ^wp-content/uploads/?(.+)\.(jpe?g|png)$ /wp-content/smush-webp/$1.$2.webp [NC,T=image/webp,$
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>

<IfModule headers_module>
Header append Vary Accept env=WEBP_image
</IfModule>

<IfModule mime_module>
AddType image/webp .webp
</IfModule>
# END SMUSH-WEBP
</Directory>
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.