diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/options-permalink.php --- a/wp/wp-admin/options-permalink.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-admin/options-permalink.php Fri Sep 05 18:40:08 2025 +0200 @@ -57,14 +57,14 @@ ); $help_sidebar_content = '
' . __( 'For more information:' ) . '
' . - '' . __( 'Documentation on Permalinks Settings' ) . '
' . - '' . __( 'Documentation on Using Permalinks' ) . '
'; + '' . __( 'Documentation on Permalinks Settings' ) . '
' . + '' . __( 'Documentation on Using Permalinks' ) . '
'; if ( $is_nginx ) { - $help_sidebar_content .= '' . __( 'Documentation on Nginx configuration.' ) . '
'; + $help_sidebar_content .= '' . __( 'Documentation on Nginx configuration.' ) . '
'; } -$help_sidebar_content .= '' . __( 'Support' ) . '
'; +$help_sidebar_content .= '' . __( 'Support forums' ) . '
'; get_current_screen()->set_help_sidebar( $help_sidebar_content ); unset( $help_sidebar_content ); @@ -73,10 +73,11 @@ $iis7_permalinks = iis7_supports_permalinks(); $permalink_structure = get_option( 'permalink_structure' ); -$prefix = ''; -$blog_prefix = ''; +$index_php_prefix = ''; +$blog_prefix = ''; + if ( ! got_url_rewrite() ) { - $prefix = '/index.php'; + $index_php_prefix = '/index.php'; } /* @@ -85,7 +86,9 @@ * network. If the `permalink_structure` option has been changed to remove this * base prefix, WordPress core can no longer account for the possible collision. */ -if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) { +if ( is_multisite() && ! is_subdomain_install() && is_main_site() + && str_starts_with( $permalink_structure, '/blog/' ) +) { $blog_prefix = '/blog'; } @@ -107,8 +110,9 @@ if ( ! empty( $permalink_structure ) ) { $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); - if ( $prefix && $blog_prefix ) { - $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); + + if ( $index_php_prefix && $blog_prefix ) { + $permalink_structure = $index_php_prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); } else { $permalink_structure = $blog_prefix . $permalink_structure; } @@ -143,15 +147,19 @@ } if ( $iis7_permalinks ) { - if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) { + if ( ( ! file_exists( $home_path . 'web.config' ) + && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) + ) { $writable = true; } else { $writable = false; } -} elseif ( $is_nginx ) { +} elseif ( $is_nginx || $is_caddy ) { $writable = false; } else { - if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { + if ( ( ! file_exists( $home_path . '.htaccess' ) + && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) + ) { $writable = true; } else { $writable = false; @@ -182,7 +190,7 @@ 'web.config
'
);
}
- } elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
+ } elseif ( ! $is_nginx && ! $is_caddy && $htaccess_update_required && ! $writable ) {
$message = sprintf(
/* translators: %s: .htaccess */
__( 'You should update your %s file now.' ),
@@ -195,7 +203,7 @@
add_settings_error( 'general', 'settings_updated', $message, 'success' );
}
- set_transient( 'settings_errors', get_settings_errors(), 30 );
+ set_transient( 'settings_errors', get_settings_errors(), 30 ); // 30 seconds.
wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
exit;
@@ -211,145 +219,231 @@