Two urls for one website

Move the wordpress site to his new domain. Make sure everything is working, hint: update all url’s using Velvet Blues Plugin Point the old domain to a directory containing only two files: A file named “index.php” containing: <?php $goto = $_SERVER[“REQUEST_URI”]; header(“HTTP/1.1 301 Moved Permanently”); header( “Location: http://new-domain-name.ch” . $goto ); ?> And a file … Read more

Change cannonical URL after changing url with add_rewrite_rule()

Okay, I found a way to do it, if someone ever need to create a permalink or change a permalink for a virtual page or a dynamic page, here’s how: The get_permalink(), the_permalink() and get_the_permalink() functions may be filtered by using the post_type_link, page_link and/or post_link filters, each one of these is for one kind … Read more

Configuring Home Page Address

If there is no clear evidence of any present redirect from the following sources: The htaccess, both under the public_html and under the public_html/folder (where folder is the directory having all the wp files), removing and regenerating them by mean of updating the permalinks, The .htaccess files were at some point deleted, and regenerated, The … Read more

wp_get_canonical_url showing first url of the post for custom page

This is because wp_get_canonical_url can only be used on posts, and cannot be used for tags authors archives etc. Returns the canonical URL for a post. https://developer.wordpress.org/reference/functions/wp_get_canonical_url/ More specifically, no equivalent exists for tag archives because archives and listings do not have canonical URLs. A canonical URL indicates to a search engine the correct and … Read more