tags:

views:

42

answers:

1

I am working on making urls like example.com/profile/username to work where example.com runs Wordpress(latest release). The install is on root. I wrote a plugin hook to catch template_redirect and I examine the URL to see if it is a profile request and then I show the profile.

But, when a URL that does not exist is typed, Wordpress does an auto search for related posts before triggering a 404 or template redirect.

For example, example.com/profile/foobar goes to another page which has foobar in its title like example.com/2009/10/1/foobar

How do I stop this from happening?

A: 

I haven't upgraded my wordpress blog in probably 2 years (posts or software), but my first thought was a .htaccess file. I looked at the main one and found:

But that doesn't explain search results right off. So I found this file

/wp-includes/rewrite.php

which has a few dealings with permalinks and search results. The main one I spotted was:

  // Search
  $search_structure = $this->get_search_permastruct();
  $search_rewrite = $this->generate_rewrite_rules($search_structure, EP_SEARCH);
  $search_rewrite = apply_filters('search_rewrite_rules', $search_rewrite);

Basically, if all searches are turned into permalinks and all permalinks are rewritten to a script that creates a generic page, you get the /foobar page...

I'll keep you posted on what I find.

Anthony