How Do I Hijack a WordPress URL?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

How Do I Hijack a WordPress URL?

Post by volomike »

Let's say I have a WordPress installed at either:

http://me/mysite

or

http://mysite

So, let's call that http://[website] for what I'm about to discuss.

Now let's say I want to create a plugin that hijacks a URL out of WordPress. For instance, I could install a web app as a plugin into this folder:

wp-content/plugins/mycatalog

And then have an admin panel that lets me set what URL to hijack in WordPress such that it directs all traffic off that URL to:

wp-content/plugins/mycatalog/app.php

So, if I have:

http://[website]/catalog

or

http://[website]/catalog/product/400

...then it would know to push both those calls to:

wp-content/plugins/mycatalog/app.php

You know, I can edit an .htaccess file, but that's not the "WordPress way". Instead, I need a hook of some sort in my plugin so that I trap the URL that way and push it to the proper file.

So, via a plugin, what's the way to hijack a given URL off of the WP install so that it sends all traffic to my plugin's app.php file?
User avatar
volomike
Forum Regular
Posts: 633
Joined: Wed Jan 16, 2008 9:04 am
Location: Myrtle Beach, South Carolina, USA

Re: How Do I Hijack a WordPress URL?

Post by volomike »

I came up with a solution:

http://stackoverflow.com/questions/1984 ... 85#1984985

This could then be attached to a custom admin panel such that one could hijack any URL they want.

This gives one the ability to embed another web app inside of WordPress. So one may ask -- why do that? Well, by doing that, you get these advantages:

1. Can drive sales off something that is an addon to WordPress. Since WP has "buzz" in the marketplace, so too can the web app.

2. Solves the customer question -- "Can it integrate with my WordPress site?"

3. Gives you an authenticated admin login page and a place to park an admin panel for your web app.
Post Reply