• Resolved kris1110

    (@kris1110)


    Hi I have problem with set right path for Bedrock boilerplate.

    Uploads have path web/app/uploads.

    How can I set right path by webpc_uploads_path filter ?

    • This topic was modified 6 years ago by kris1110.
Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @kris1110,

    Thank you for your message.

    Recently, someone else contacted me about this. In this thread: https://wordpress.org/support/topic/files-created-in-uploads-folder/

    Could you answer that thread? This one will be closed.

    Thread Starter kris1110

    (@kris1110)

    I tested your 1.1.3 beta version plugin but I got these errors:

    The path for uploads files does not exist. Please use the webpc_uploads_path filter to set the correct path. The default path is: C:\xampp\htdocs\projects\project\web\wp/wp-content/uploads/.

    Unable to create or edit .htaccess file. Please change directory permissions. The default path of file is: C:\xampp\htdocs\projects\project\web\wp/wp-content/uploads/.htaccess.

    • This reply was modified 6 years ago by kris1110.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    What filters did you use? Give me the exact code you added.

    Thread Starter kris1110

    (@kris1110)

    I checked webpc_uploads_root filter :
    add_filter(‘webpc_uploads_root’, function($path) {
    var_dump($path);
    });

    it ($path) returns: C:\xampp\htdocs\projects\project\web\wp/

    What filter I should add ?

    • This reply was modified 6 years ago by kris1110.
    • This reply was modified 6 years ago by kris1110.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    What do you get when you call the following code?

    <?php
    
      echo '<pre>';
        echo '1. ' . apply_filters('webpc_uploads_path', '', true);
        echo PHP_EOL;
        echo '2. ' . apply_filters('webpc_uploads_webp', '', true);
        echo PHP_EOL;
        echo '3. ' . apply_filters('webpc_uploads_path', '', false);
        echo PHP_EOL;
        echo '4. ' . apply_filters('webpc_uploads_webp', '', false);
        echo '</pre>';
      exit;
    Thread Starter kris1110

    (@kris1110)

    1. wp-content/uploads
    2. wp-content/uploads-webpc
    3. C:\xampp\htdocs\projects\project\web\wp//wp-content/uploads
    4. C:\xampp\htdocs\projects\project\web\wp//wp-content/uploads-webpc

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Do these catalogs from points 3 and 4 exist with you? Do you have write access there?

    Thread Starter kris1110

    (@kris1110)

    No they don’t exist, my uploads catalog there is in C:\xampp\htdocs\projects\project\web\app\uploads

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    In that case, how did you change the path using the webpc_uploads_root filter?

    Example:

    add_filter('webpc_uploads_root', function($root)
    {
      return ABSPATH;
    });

    Instead of ABSPATH, please give your path.

    Thread Starter kris1110

    (@kris1110)

    add_filter(‘webpc_uploads_root’, function($root)
    {
    $path = ‘C:\xampp\htdocs\projects\project\web\app\uploads’;
    return $path;
    });

    If I give my path manually, did makes the same errors like above.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    What do you get when you call the following code now?

    <?php
    
      echo '<pre>';
        echo '1. ' . apply_filters('webpc_uploads_path', '', true);
        echo PHP_EOL;
        echo '2. ' . apply_filters('webpc_uploads_webp', '', true);
        echo PHP_EOL;
        echo '3. ' . apply_filters('webpc_uploads_path', '', false);
        echo PHP_EOL;
        echo '4. ' . apply_filters('webpc_uploads_webp', '', false);
        echo '</pre>';
      exit;
    Thread Starter kris1110

    (@kris1110)

    Still the same

    1. wp-content/uploads
    2. wp-content/uploads-webpc
    3. C:\xampp\htdocs\projects\project\web\wp//wp-content/uploads
    4. C:\xampp\htdocs\projects\project\web\wp//wp-content/uploads-webpc

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @kris1110, please download the plugin code from my site again. The link is the same. I corrected one thing there that should help.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    In addition, please use the following filters:

    This filter only indicates your main WordPress installation directory (not the uploads directory):

    add_filter('webpc_uploads_root', function($path)
    {
      return 'C:/xampp/htdocs/projects/project/web/';
    });

    Here you specify the path to the uploads directory relative to the root directory:

    add_filter('webpc_uploads_path', function($path)
    {
      return 'app/uploads;
    });

    Here you specify the path to the uploads-webpc directory relative to the root directory:

    add_filter('webpc_uploads_webp', function($path)
    {
      return 'app/uploads-webpc';
    });

    After setting the filters, turn the plugin off and on.

    Thread Starter kris1110

    (@kris1110)

    Hi
    I added :

    add_filter('webpc_uploads_root', function($path)
    {
      return 'C:/xampp/htdocs/projects/project/web/';
    });
    add_filter('webpc_uploads_path', function($path)
    {
      return 'app/uploads';
    });
    add_filter('webpc_uploads_webp', function($path)
    {
      return 'app/uploads-webpc';
    });

    The error has disappeared, but htaccess have incorrectly url:
    it should be web/app not web/wp/app

    
    # BEGIN WebP Converter
    # ! --- DO NOT EDIT PREVIOUS LINE --- !
    <IfModule mod_mime.c>
      AddType image/webp .webp
    </IfModule>
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/projects/project/web/wp/app/uploads-webpc/$1.jpg.webp -f
      RewriteRule (.+)\.jpg$ /projects/project/web/wp/app/uploads-webpc/$1.jpg.webp [T=image/webp]
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/projects/project/web/wp/app/uploads-webpc/$1.jpeg.webp -f
      RewriteRule (.+)\.jpeg$ /projects/project/web/wp/app/uploads-webpc/$1.jpeg.webp [T=image/webp]
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/projects/project/web/wp/app/uploads-webpc/$1.png.webp -f
      RewriteRule (.+)\.png$ /projects/project/web/wp/app/uploads-webpc/$1.png.webp [T=image/webp]
    </IfModule>
    <IfModule mod_expires.c>
      ExpiresActive On
      ExpiresByType image/webp "access plus 1 year"
    </IfModule>
    # ! --- DO NOT EDIT NEXT LINE --- !
    # END WebP Converter
Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Server configuration error. Correct path for Bedrock’ is closed to new replies.