Redirect based on referer using Advanced Custom Fields

Try the template_redirect hook function portal_protection() { if ( get_field(‘enable_portal_protection’) && !current_user_can(‘administrator’) ) { $referring_url = get_field(‘referring_url’); $redirect_url = get_field(‘redirect_url’); $referer = $_SERVER[‘HTTP_REFERER’]; if ( $referer != $referring_url) { wp_redirect( $redirect_url ); exit; } } } add_action( ‘template_redirect’, ‘portal_protection’ ); Also use wp_redirect. it’s the WordPress way of redirecting.

redirect to https://my-site/wp-admin/ instead of https://my-site/wordpress/wp-admin/ after options updating

The solution was : not use the index.php to include the folder /wordpress/ not use wordpress/.htaccess use only .htaccess to point to subfolder <IfModule mod_rewrite.c> RewriteEngine On #https RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} ^(www.)?my-site.com$ #point to subfolder RewriteCond %{REQUEST_URI} !^/wordpress/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /wordpress/$1 RewriteCond %{HTTP_HOST} … Read more

There is 1 redirect

The 301 redirect is from http:// to https://. Your rewrite rule specifies https:// while your WP_HOME and WP_SITEURL are set to use http://. That’s why you’re seeing the 301 redirect from http://www.b-secrets.ro to https://www.b-secrets.ro.

How to get user details by name

“Users” are basically “authors” in WordPress so those pages are available at example.com/author/{user-name}/ (with or without the trailing slash) and what you are looking for is actually to change the “author permalink base” for the URL rewrite. eg: add_action( ‘init’, ‘set_custom_author_base’ ); function set_custom_author_base() { global $wp_rewrite; $wp_rewrite->author_base=”user”; } You can then add (or modify) … Read more

Redirect not work

When you’re inside a class, you need to pass a reference to WordPress for WordPress to call the function within the class. See the line that contains $this. class My_Users { public function __construct() { add_action( ‘do_redirect’, array( $this, ‘redirect’ ) ); } public function redirect() { $url = get_site_url( null, ‘/welcome’, ‘https’ ); wp_safe_redirect( … Read more