So, I’ve just installed a code pasting utility on my website (like PasteBin basically, but using the open source PASTE script).
At the moment, a paste will be saved in the SQL database, with an integer ID.
The paste utilities directory is http://example.com/paste, and pastes can be found at http://example.com/paste/12345.
What I’d like to do, is create an htaccess rule so that when the user clicks on http://example.com/12345, they will be taken to http://example.com/paste/12345.
I’ve looked around at other questions, but none seem to ask (or solve) the same sort of question. But I could have looked in the wrong place, and someone will have a link to an answer within minutes of me posting. That would be equally great, but I’d prefer a more tailored solution, if possible.
NOTE: If anyone just wants to change the clickable link from http://example.com/paste/12345 (for example) to http://example.com/p/12345 without changing the actual subfolder name, check out my comment in the Accepted Answer. Otherwise, Dope Monk’s solution will work fine for my initial problem.
You will need to have a simple rule in your .htaccess using mod_rewrite. However, you must ensure that mod_rewrite is enabled when you use this rule
Add this: