Tagged: frontpage settings
Dear support team, dear forum,
As part of the frontpage setting, I have selected a page that is unfortunately not displayed. Only when I specify this page as a custom 404 page is it displayed. However, I then get the https://MEINESEITE.com/?avia_forced_reroute=1 after my domain name in the address field.
If I use the option “Display selected page without redirect” under the custom 404 settings, there is no addition in the address bar.
Do you have any idea why my selected page in the frontpage setting is not working?
Many thanks.
Kind regards,
bleistift
Enfold 6.0.5, WP 6.6.2
Hey bleistift,
I changed the 404 settings and it’s working as expected, please review your site. Note that you cannot use your front page as the custom 404 page, please try creating a dedicated 404 page instead.
Best regards,
Rikard
is that what you like to have not a Maintenance Mode Page. Why do you work with a 404 page instead?
there might be good reasons to redirect all 404 to the home page url.
And this is the snippet way to do it –
put in your child-theme functions.php:
add_action('template_redirect', function(){
if(is_404()){
wp_safe_redirect(home_url());
exit();
}
});
Offtopic
by the way – the template_redirect could be used to have not the ugly : //domain/?s=xyz on search results page
but //domain/search/xyz
function re_rewrite_rules() {
global $wp_rewrite;
$wp_rewrite->search_base = 'search';
$wp_rewrite->flush_rules();
}
add_action('init', 're_rewrite_rules');
function change_search_url() {
if ( is_search() && ! empty( $_GET['s'] ) ) {
wp_redirect( home_url( '/search/' ) . urlencode( get_query_var( 's' ) ) );
exit();
}
}
add_action( 'template_redirect', 'change_search_url' );