Simone: .htaccess Umleitung

Beitrag lesen

Vielen Dank für Deine Antwort!

Frage: Findet denn schon eine Umleitung statt.

Ja, definitiv als CMS läuft WordPress, also gibt es physikalisch keine statische Datei auf dem Server...

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

https://www.example.org/job/11364/ = https://www.example.org/job/POST-ID/

Wollte jedoch auf einen Wordpress Hook verzichten, da ich mich nicht auskenne.

Für mich einfacher währe eine Weiterleitung an ein PHP Script wenn eine 301 vorliegt.

<?php 
$url = "https://www.example.org/job/12235-1/";




echo "<pre>";
print_r(getHttpCode( $url ));
echo "</pre>";



function getHttpCode( $url )
{
    $ch = curl_init();

    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    curl_exec($ch);
    $info = curl_getinfo($ch);
    curl_close($ch);

    return $info;
}

/*
Array
(
    [url] => https://www.example.org/job/12235-1/
    [content_type] => text/html; charset=UTF-8
    [http_code] => 200
    [header_size] => 561
    [request_size] => 84
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.605774
    [namelookup_time] => 0.012258
    [connect_time] => 0.012335
    [pretransfer_time] => 0.021711
    [size_upload] => 0
    [size_download] => 195165
    [speed_download] => 322174
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => 0
    [starttransfer_time] => 0.604257
    [redirect_time] => 0
    [redirect_url] => 
    [primary_ip] => *****
    [certinfo] => Array
        (
        )

    [primary_port] => 443
    [local_ip] => ******
    [local_port] => ***
)


Array
(
    [url] => https://www.example.org/job/12235/
    [content_type] => text/html; charset=UTF-8
    [http_code] => 301
    [header_size] => 416
    [request_size] => 82
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.276097
    [namelookup_time] => 0.004331
    [connect_time] => 0.004517
    [pretransfer_time] => 0.03001
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 0
    [upload_content_length] => 0
    [starttransfer_time] => 0.276072
    [redirect_time] => 0
    [redirect_url] => https://www.example.org
    [primary_ip] => 85.*****
    [certinfo] => Array
        (
        )

    [primary_port] => 443
    [local_ip] => *****
    [local_port] => ***
)

Beste Grüße Simone