Support

Admin Tools

#28089 Tip: Admin tools .htaccess webp images

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by on Thursday, 10 August 2017 17:17 CDT

wolga
I don't need support. This is only a tip for Admin Tools Users.
I've used Akeeba Pro since Joomla 1.5 and have not been hacked one time. I'm pretty sure it's due to the benefit of Admin Tools. Thanks

I just wanted to create a searchable document for those who use the .htaccess generator in Admin Tools.

I was asked to look into why a webp image was getting a permission denied.

I did some GoogleResearch and found that it is a new image format and while in transition you have to add some code to the .htaccess file.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
    RewriteRule ^(wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>

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

AddType image/webp .webp


Did not cure the issues and it didn't take me long to figure maybe somewhere in the .htacces file there was something disallowing it.

It was simple once I spotted the culprit.

SIMPLY add in Upper and Lower case, webp and WEBP to your allowed file formats area.

See screenshot.

nicholas
Akeeba Staff
Manager
That .htaccess code only applies to WordPress. It says that IF the remote browser accepts image/webp AND the request is made to a jpg/png image in wp-content/uploads (the default WordPress location) THEN pretend you didn't listen and deliver the same image with a .webp suffix instead AND a forced MIME type of image/webp. This means that the code will not only do nothing on Joomla!, it would only even work on WordPress if you had a very specific setup: all the images you uploaded were both in JPG/PNG and WEB-P formats using the exact same filename and file path. So, all that code is unnecessary ;)

As for delivering .webp files, indeed: you need to add that extension to the list of allowed extensions. Even if we added it manually it would only affect new installations of Admin Tools. Existing installations' configurations are not overwritten when you update (that would seriously suck!).

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

wolga
I removed the above-listed code un-needed code and it still works. Of course, as you mentioned, I left it in the list of allowed extensions as shown in the screenshot.
Brilliant. Thank you.

nicholas
Akeeba Staff
Manager
You're welcome :)

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!