Make WordPress Core

Changeset 57612


Ignore:
Timestamp:
02/13/2024 10:06:22 AM (4 months ago)
Author:
swissspidy
Message:

Permalinks: Detect Caddy web server support.

Support pretty permalinks when Caddy server is detected.

Props swissspidy, mukesh27, sadpencil, cfinnberg, viliamkopecky.
Fixes #41877.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/misc.php

    r57595 r57612  
    4040 *
    4141 * @global bool $is_nginx
     42 * @global bool $is_caddy
    4243 *
    4344 * @return bool Whether the server supports URL rewriting.
    4445 */
    4546function got_url_rewrite() {
    46     $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() );
     47    $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || $GLOBALS['is_caddy'] || iis7_supports_permalinks() );
    4748
    4849    /**
  • trunk/src/wp-admin/options-permalink.php

    r55703 r57612  
    155155        $writable = false;
    156156    }
    157 } elseif ( $is_nginx ) {
     157} elseif ( $is_nginx || $is_caddy ) {
    158158    $writable = false;
    159159} else {
     
    191191                );
    192192            }
    193         } elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
     193        } elseif ( ! $is_nginx && ! $is_caddy && $htaccess_update_required && ! $writable ) {
    194194            $message = sprintf(
    195195                /* translators: %s: .htaccess */
  • trunk/src/wp-includes/vars.php

    r56638 r57612  
    1818global $pagenow,
    1919    $is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE, $is_edge,
    20     $is_apache, $is_IIS, $is_iis7, $is_nginx;
     20    $is_apache, $is_IIS, $is_iis7, $is_nginx, $is_caddy;
    2121
    2222// On which page are we?
     
    128128
    129129/**
     130 * Whether the server software is Caddy or something else
     131 *
     132 * @global bool $is_caddy
     133 */
     134$is_caddy = ( str_contains( $_SERVER['SERVER_SOFTWARE'], 'Caddy' ) );
     135
     136/**
    130137 * Whether the server software is IIS or something else
    131138 *
Note: See TracChangeset for help on using the changeset viewer.