• Just installed the plugin, and all images got broken with a ‘403 forbidden’ error pointing to adaptive-images-script.php

    I’m testing on WAMP localhost. At glance, the rewrite rule inserted into .htaccess seems wrong.

    What I got:

    RewriteRule \.(?:jpe?g|gif|png)$ /D:\domains\www.mydomain.com\wp-content\plugins\adaptive-images/adaptive-images-script.php [L]

    What I changed to, to make it work:

    RewriteRule \.(?:jpe?g|gif|png)$ /wp-content/plugins/adaptive-images/adaptive-images-script.php [L]

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Takis Bouyouris

    (@nevma)

    Hello, my friend,

    Thank you for the heads-up!

    I believe that this issue has to do with the way WAMP has set up the server on localhost. I have never come across such an issue on an online server. And, to be honest, the Adaptive Images features are not so relevant on localhost anyway.

    Could you test this in your online environment and see if you can reproduce it in some way? I’d be more than happy to take a look at it there, where the conditions are closer to the real world.

    Cheers,
    Takis

    Thread Starter alx359

    (@alx359)

    Hi Takis, and thanks for your quick reply. I’m afraid to mess with my live site right now, as there’s another image+caching solution already in place working smoothly of Nginx over Apache.

    Taking a quick-look at the code in adaptive-images-actions.php though, it seems apparent the concatenations happening to $adaptive_images_php_script imply a unix-style path. As each save of the AI settings also modifies .htaccess, adding the following piece of code is currently addressing the Windows/WAMP idiosyncrasies for me:

    adaptive-images-actions.php ~line 150

    // If no starting slash then add it.
    if ( strpos( $adaptive_images_php_script, '/' ) !== 0 ) {
        $adaptive_images_php_script = '/' . $adaptive_images_php_script;
    }
    #alx359-->
    // https://stackoverflow.com/questions/1240462/
    if( strtoupper(substr(PHP_OS, 0, 3) ) === 'WIN') {
        $adaptive_images_php_script = realpath( $adaptive_images_dir_path_relative . '/adaptive-images-script.php' );
        $adaptive_images_php_script = str_replace( '\\','/',$adaptive_images_php_script );
        $adaptive_images_php_script = str_replace( $_SERVER['DOCUMENT_ROOT'], '', $adaptive_images_php_script );
        //$adaptive_images_php_script = '//'.$_SERVER['HTTP_HOST'].$adaptive_images_php_script;
    }
    //error_log( var_export( $adaptive_images_php_script , true ) );
    #<--alx359

    Hope you may consider a better compatibility with the aforementioned configuration in the near future.

    Thanks.

    Plugin Author Takis Bouyouris

    (@nevma)

    Hello, again,

    You are right, this is most probably they culprit. We were not expecting the plugin to be installed and tested in any kind of Window environment. Will make a note of it for future versions.

    Cheers,
    Takis

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘403 forbidden fix’ is closed to new replies.