Orijinal Link:
https://pyroautotransport.com/checkout?quote=910fdb10-5a00-11ef-8d4b-6bc2018ed9b6Temiz Link:
https://pyroautotransport.com/checkout/910fdb10-5a00-11ef-8d4b-6bc2018ed9b6Localhost'da bunu yapmayi basardim.
functions.php
function custom_checkout_rewrite_rules() {
// Add the first rewrite rule for checkout with quote
add_rewrite_rule(
'^checkout/([^/]*)/?$', // Regex to match the new URL structure
'index.php?pagename=checkout"e=$matches[1]', // Map to the original query var
'top'
);
// Add the second rewrite rule for checkout with vehicle details
add_rewrite_rule(
'^checkout/([^/]+)/vehicle-details/?$', // The URL structure to match
'index.php?pagename=checkout"e=$matches[1]&step=vehicle-details', // The WordPress query variables to use
'top'
);
}
add_action('init', 'custom_checkout_rewrite_rules');
function add_custom_query_vars($vars) {
// Use a single query var for both purposes
$vars[] = 'quote';
$vars[] = 'step';
return $vars;
}
add_filter('query_vars', 'add_custom_query_vars');Daha sonra .htaccess dosyasina asagidaki kodu ekledim. hersey calisti diledigim gibi localde.# Custom Rewrite Rule for Quote Parameter and Vehicle Details <IfModule mod_rewrite.c> RewriteEngine On # Custom rewrite rule to transform /checkout/quote-id/vehicle-details into /checkout/?quote=quote-id&step=vehicle-details RewriteRule ^checkout/([a-zA-Z0-9-]+)/vehicle-details/?$ /checkout/?quote=$1&step=vehicle-details [L,QSA] # Existing rewrite rule to transform /checkout/quote-id/ into /checkout/?quote=quote-id RewriteRule ^checkout/([a-zA-Z0-9-]+)/?$ /checkout/?quote=$1 [L,QSA]Uzun lafin kisasi, Host'da calismadi.( OPENLITESPEED ) ayni .htaccess dosyasi. hersey ayni.
