mod_rewrite_rules example

$home_path     = get_home_path();
    $htaccess_file = $home_path . '.htaccess';

    /* * If the file doesn't already exist check for write access to the directory * and whether we have some rules. Else check for write access to the file. */
    if ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks()
        || is_writable( $htaccess_file )
    ) {
        if ( got_mod_rewrite() ) {
            $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );

            return insert_with_markers( $htaccess_file, 'WordPress', $rules );
        }
    }

    return false;
}

/** * Updates the IIS web.config file with the current rules if it is writable. * If the permalinks do not require rewrite rules then the rules are deleted from the web.config file. * * @since 2.8.0 * * @global WP_Rewrite $wp_rewrite WordPress rewrite component. * * @return bool|null True on write success, false on failure. Null in multisite. */

} elseif ( $is_nginx ) {
    $writable = false;
} else {
    if ( ( ! file_exists( $home_path . '.htaccess' )
        && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' )
    ) {
        $writable = true;
    } else {
        $writable       = false;
        $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
        $new_rules      = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );

        $htaccess_update_required = ( $new_rules !== $existing_rules );
    }
}

$using_index_permalinks = $wp_rewrite->using_index_permalinks();

if ( $structure_updated ) {
    $message = __( 'Permalink structure updated.' );

    if ( ! is_multisite() && $permalink_structure && ! $using_index_permalinks ) {
        
Home | Imprint | This part of the site doesn't use cookies.