Dynamic redirect

Already solved using this code inside functions.php: add_action(‘template_redirect’, function() { if (is_single() && get_post_type(get_queried_object_id()) == ‘sorteio’) wp_redirect(‘edicao/?id=’ . get_queried_object_id()); });

Delete Redirect Slug For Specific Post

The wp_postmeta table (all meta tables in WP work similarly) has the following fields: id: the primary key of the metadata item post_id: the primary key of the post that this metadata relates to meta_key: the metadata “key”, or name of the metadata meta_value: the actual metadata value itself To find old slug entries for … Read more

How to fix automatic redirects?

Those aren’t really redirects, the “Hash” part of a URL (the # and anything after that) are purely client side and will not trigger another request to your server. The reason for it is AddThis. Here’s an explanation as to why they are doing that: What is AddThis Click Tracking? You can disable it by … Read more

Redirection on domain name

If you call $ curl -I https://glaszetterdirect.nl you can see the the response charset is UTF-8 which indicates the redirect is done by WordPress, not the webserver. $ curl -I http://www.glaszetterdirect.nl HTTP/1.1 301 Moved Permanently Date: Fri, 05 Oct 2018 08:24:41 GMT Expires: Fri, 05 Oct 2018 09:24:42 GMT Cache-Control: max-age=3600 Location: https://glaszetterdirect.nl/wp-admin/ Content-Length: 0 … Read more

Redirect loop with similar URLs

RedirectMatch is very helpful if you want to redirect according to regular expression or similar. This is not needed here, and could be the very reason of your problem. Try the following instead Redirect 301 /fall /fall-2019

Custom URL routes

All internal rewrite rules must point to index.php. This isn’t a theme file, it’s the main bootstrap file in the root of your WordPress install. So, your rule should look like: add_action( ‘init’, ‘wpse26388_rewrites_init’ ); function wpse26388_rewrites_init(){ add_rewrite_rule( ‘properties/([0-9]+)/?$’, ‘index.php?pagename=single-deal&property_id=$matches[1]’, ‘top’ ); } You can then assign the deal.php template to your single-deal page in … Read more

How can I redirect a request to the site root using htaccess, if there’s not a specific cookie set?

if the cookie “language_known” isn’t set to the value “yes”. RewriteCond %{HTTP_COOKIE} !language_known=true;? [NC] The condition is checking that the value is not “true” (string), not “yes”? However, the rule is also configured as a 301 (permanent) redirect, so this will be cached persistently by the browser. If the browser has redirected once, when the … Read more