/*
Plugin Name: WP Redirect Permallink (Modified)
Plugin URI: https://nabtroneb.com/wp-redirect-permalink/
Description: Redirects old permalink formats to new format based on configuration.
Author: nabtron (modified by Bard)
Version: 1.0.12
Author URI: https://nabtroneb.com/
*/
function wp_redirect_permalink() {
// Acquire the complete URL of the current page
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
// Define the old and new permalink structures
$old_formats = array(
"/(.+?)\/(.+?)\.html\/?$/i", // /%category%/%postname%.html
"/(.+?)\/?$/i", // /%postname%
);
$new_format = "/$2.html"; // /%postname%.html
// Iterate through old formats and redirect if matched
foreach ($old_formats as $old_format) {
if (preg_match($old_format, $actual_link, $matches)) {
$new_redirect_link = preg_replace($old_format, $new_format, $actual_link);
// Perform 301 redirect
wp_redirect($new_redirect_link, 301);
exit;
}
}
}
add_action('template_redirect', 'wp_redirect_permalink');
Türk Yahudi Toplumu – Musevi Dini Bayramları ve Kutsal Günleri Musevi dini bayramları ve kutsal günleriyle Musevi dinine ilişkin öteki anma, kutlama ve oruç günleri İbrani Takvimi esasına …
Dünyanın 7 (Yedi) Harikası İngilizce Tanıtımı ( Kısa ) Dünyanın 7 (Yedi) Harikası Great Pyramid of Giza / Keops Piramidi İngilizce In honor of the Egyptian Pharaoh Khufu, known …