Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4051876
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:14:58+00:00 2026-05-20T14:14:58+00:00

I am managing a wordpress blog and want to throw a 404 error whenever

  • 0

I am managing a wordpress blog and want to throw a 404 error whenever the url contains a string pattern (example: if the url contains “thisisnotwanted”). I was thinking I will be able to add something to the htaccess file like: Redirect “thisisnotwanted” 404

Can someone help? I just don’t want Google to index pages with this parameter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:14:59+00:00Added an answer on May 20, 2026 at 2:14 pm

    This could be achived using robots.txt but since you’re asking how to throw the 404 page manualy here it is :

    <?php
    if ( preg_match('/thisisnotwanted/i',$_SERVER["REQUEST_URI"]) ) {
        header("HTTP/1.0 404 Not Found - Archive Empty");
        require TEMPLATEPATH.'/404.php';
        exit;
    }
    get_header();
    ?>
    

    This bit of code is just an example on how you can display a 404 page, and it shouldn’t be used in “production”, instead use robots.txt as Michiel Pater sugested .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am managing a few WordPress installations and I'm tired of the error logs
I'm creating a Wordpress plugin for collectively managing a Twitter account. I want to
I've been successful in managing several authors on a WordPress blog thanks to this
I'm managing dialogs by showDialog / dismissDialog / removeDialog . I want to: Display
I have a client who is managing 30+ Wordpress sites. Each Wordpress install may
I'm using this tutorial on AsyncTask with a task and a notification: https://eliasbland.wordpress.com/2011/03/11/an-example-of-how-to-run-a-background-task-and-report-progress-in-the-status-bar-using-asynctask-on-android/ What
Managing url paths can be a real pain in ASP.NET. AbsolutePath vs RelativePath vs
I'm managing an instance of Wordpress where the URLs are in the following format:
I have question about managing transaction in asp.net application. For example i have application
When managing shader's, does it make sense to have all of them compiled and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.