Redirect/block WordPress URLs with the /?p=x structure. Eg.

I'm building a site with hashed permalinks so I can email a style URL to a client. It's to provide a level of privacy without the need to log in or dick around with passwords.

Unfortunately, WordPress redirects any URL with the ?p=x url structure:

so redirects to

Obviously, the hashed URL is pretty useless when someone can run through /?p=xx and see every post and page I've ever made.

Is there a way to stop WordPress from redirecting this type of link and either throwing a 404 or redirecting to the homepage?

I only want the page to be accessible from the "proper" style of URL.


Solution ...sort of Added to top of .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} /?p=(\d*)
RewriteRule ^$ *? [R=404,L]

I don't really get it... but this works. Ideally it would redirect to the wordpress 404 page, however.

Need Your Help

Jquery .on and .off is not working with mouseenter and mouseleave events

jquery html5 mouseenter mouseleave

I am trying to play with jQuery mouseenter and mouseleave events but failing.

reduce javascript code when using the map function

javascript dictionary lodash

I want to iterate over an array and do something to each of the element

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.