• Resolved mdotblank

    (@mdotblank)


    Hello Mateusz,

    first of all, thank you for putting your time and effort into developing and maintaining this plugin. I’ve encountered a problem while configuring the plugin on my server, which is hosted by IONOS (formerly 1&1). Long story short: It turns out that IONOS does not populate the ${DOCUMENT_ROOT} env var, which is used in your plugin’s .htaccess config. As a result, the redirect to the WebP file didn’t work and I received the infamous “rewrites_not_working” error message.

    I’ve resolved the issue by editing the htaccess file manually and replacing %{DOCUMENT_ROOT} with the full file system path of my WordPress installation (which in the case of IONOS is something like /homepages/##/######/htdocs/wp-content/). However, this only seems to be a temproary fix, because my changes are overwritten everytime I open the plugin’s settings page.

    Would it be possible to have an option where the plugin would use the absolute file path instead of %{DOCUMENT_ROOT} when writing the .htaccess file? Wouldn’t that be basically just the value of the ABSPATH constant? Or if that’s not possible, I’d have no problem entering the path manually in some text field in the settings area.

    Thanks in advance,
    Marcel

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @mdotblank,

    Thank you for your message.

    Add the following code to the functions.php file in your theme directory:

    add_filter( 'webpc_htaccess_mod_rewrite', function( $rules, $path ) {
      $root_path = trim( str_replace( '\\', '/', ABSPATH ), '/' );
      return str_replace( '%{DOCUMENT_ROOT}', $root_path, $rules );
    }, 10, 2 );

    And then save the plugin settings again. This should solve your problem.

    Thread Starter mdotblank

    (@mdotblank)

    Great, that should have permanently solved the problem for now. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Server configuration error: a possible fix on sites hosted by IONOS’ is closed to new replies.