Host the wp-admin on another domain?
Easy solution would be adding this line to your wp-config.php of your admin server code. define( ‘WP_SITEURL’, ‘http://’ . $_SERVER[‘SERVER_NAME’]); Then you can access it without modifying the database option.
Easy solution would be adding this line to your wp-config.php of your admin server code. define( ‘WP_SITEURL’, ‘http://’ . $_SERVER[‘SERVER_NAME’]); Then you can access it without modifying the database option.
I believe that is the redirect_canonical function hooked to template_redirect. You should be able to disable it with: remove_filter(‘template_redirect’, ‘redirect_canonical’); But you should really think about whether you want to do that as it is fairly complicated and performs some important SEO functions: Redirects incoming links to the proper URL based on the site url. … Read more
.htaccess skip WordPress 404 error handling for static files. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap\.xml(\.gz)?) RewriteCond %{REQUEST_FILENAME} \.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC] RewriteRule .* – [L] </IfModule> Note: These rules were generated by the W3 Total Cache plugin* Nginx skip WordPress 404 handling for static files. if (-f $request_filename) { break; … Read more
This worked for me: remove_action(‘template_redirect’, ‘redirect_canonical’);
Here are 2 examples which you will need to modify slightly to get it working for your specific needs. add_action( ‘admin_init’, ‘redirect_non_logged_users_to_specific_page’ ); function redirect_non_logged_users_to_specific_page() { if ( !is_user_logged_in() && is_page(‘add page slug or ID here’) && $_SERVER[‘PHP_SELF’] != ‘/wp-admin/admin-ajax.php’ ) { wp_redirect( ‘http://www.example.dev/page/’ ); exit; } } Put this in your child theme functions … Read more
I was able to display a 404 error by using the following code in my header. <?php global $wp_query; $wp_query->set_404(); status_header( 404 ); get_template_part( 404 ); exit(); ?> To break it down: $wp_query->set_404(): tells the wp_query this is a 404, this changes the title status_header(): sends a HTTP 404 header get_template_part(): displays the 404 template
To make sure only the front end redirects to domain.com, make a theme that uses the PHP header() function. Create a folder called redirect or something. Add two files to the folder: style.css and index.php (necessary for a valid WP theme) In style.css, add something like this: /* Theme Name: Redirect Description: Redirects the front … Read more
You could try the WordPress function status_header() to add the HTTP/1.1 404 Not Found header; So your Code 2 example would be: function rr_404_my_event() { global $post; if ( is_singular( ‘event’ ) && !rr_event_should_be_available( $post->ID ) ) { global $wp_query; $wp_query->set_404(); status_header(404); } } add_action( ‘wp’, ‘rr_404_my_event’ ); This function is for example used in … Read more
Some article I read once said that it means jumping (from one URI to another), but I detected this “302” even when there was actually no jumping at all!