WordPress 404 page by wrong url

For now only if im entering page id which doesnt exist I get the 404 page.
http://EXAMPLE.COM/?page_id=51573

But its not redirecting to 404 page if im going to http://EXAMPLE.COM/blablabla

Read More

is that possible to redirect those kind of addresses to 404 page in wordpress?

Related posts

Leave a Reply

1 comment

  1. You’ll have to create a .htaccess file and upload it to your WordPress root directory. In your .htaccess write the following:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    

    In your WordPress dashboard go to Settings > Permalinks there you choose the structure you’d like. In your case this would be postname.