[wp-hackers] Taking over URL space

Phillip Lord phillip.lord at newcastle.ac.uk
Tue Feb 21 09:58:28 UTC 2012


I was wondering whether someone could give me pointers in the right
direction. I'm not after a complete solution! I was just hoping that
someone with more knowledge of wordpress could tell me if I am heading
in the right way. 

I wanted to write a new plugin which returns metadata about posts in a
variety of different ways. To do this, I need to use various parts of
the URL space, but I don't know how best to do this. 


Essentially, I want to do three things. 

1) I would like to be able to use bits of the URL space from top level.
   So, for a wordpress at

http://mydomain.org.uk 

I would like to be able to serve all requests to..

http://mydomain.org.uk/myplugin

My initial idea was to achieve all this with rewrite rules, but
requiring users to modify .htaccess com. wp-rewrite seems the next
option -- I can just rewrite requests to this and underlying rewrite 
plugin php? 


2) I want to add support for file extension based access. So for a
URL such as 

http://mydomain.org.uk/?p=46

I'd like requests to 

http://mydomain.org.uk/?p=46.bib

to be handled by my plugin, probably by sending the browser straight to
a URL of the http://mydomain.org.uk/myplugin. I am not sure how well
this would interact with pretty permalinks -- something of the form

http://mydomain.org.uk/2012/02/02/mypost/ 

looks daft with an extension
http://mydomain.org.uk/2012/02/02/mypost/.bib

However, as far as I can see this is a similar problem to the last. 

3) 

And, finally, I'd like to provide a content negotiated solution. So
requests to:

http://mydomain.org.uk/?p=46

will return different results depending on the content type in the
Accept: header of the request; again, this will probably be implemented
by forwarding the browser. 

This one seems to be the most taxing -- I can't do this with rewrite
rules because it is the same in all cases. 

Any pointers gratefully received!

Phil



More information about the wp-hackers mailing list