0

I've made a custom page for my wordpress website which will return custom results based on the data in the URL (not a search page).

Here's what it does:

The url is something like http://example.com/CustomPage/BlaBla, while landing on the page, it is supposed to read the last part (which is BlaBla) and return results based upon that.

But i'm getting a 404 error page every time. However i can use a query like http://example.com/CustomPage?query=BlaBla and do the trick, but i want the link to have a structure like the 1st one.

Is it possible to achieve this? Any help is appreciated.

1

It's completely possible to achieve this by using custom rewrite rules. Right now I don't have the opportunity to give you the actual code for it, but you can check the documentation for add_rewrite_rule() in the Codex. It's pretty straightforward if you add a custom parameter to the rewritten URL.

Actually, you already have the almost exact parameters for the function in your question.

0

take a look at the Rewrite tag.

You can define custom tag and queries, and rewrite your custom URLs. After defining custom tag, follow this link and make a rewrite rule to create your new structure.

It's pretty easy if you follow the examples in these 2 links.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.