How Do I Hijack a WordPress URL?
Posted: Thu Dec 31, 2009 3:03 am
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?
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?