Minimalistic WP-plugin to create custom urls including custom files

I thought I should share this little wordpress plugin with you. Get it from wordpress.org here

What should I use it for?

  • XHR (AJAX-requests). When you don’t want to use wp_ajax-hook.
  • When you’re creating a RESTFUL API or something similar
  • When you just want a custom url with a custom behavior.

How it works

Let’s get down to business. It will only take you a couple of minutes.

Installation

  1. Install and activate the plugin.
  2. Activate permalinks (everything else than default is fine)
  3. Go to “yourblog.com/hello_world” and follow the instructions there.

Usage

Just include your custom urls into the array $eur_urls like this:

$eur_urls = array(
  "my-cool-url" => "my/absolute/path/to/my/cool/file.php"
);

Include this wherever you want – but suitable places would be in your theme’s functions.php or in your wp-config.php

Stuff that ain’t that awesome

It doesn’t support any wildcard or anything like that. No regular expressions. You can only use static urls. In the next version I will include an update so you can use urls like “posts/*”.

Fork it on github

Or give me some feedback! https://github.com/blmstr/easy-url-rewrite

5 thoughts on “Minimalistic WP-plugin to create custom urls including custom files”

  1. Hey, I think this is a great plugin, but I can’t seem to make it work. I added an array to functions.php or wp-config.php, in the same format in your example for my custom rewrite. But it keeps saying the page is not found.

    I want to create a simple rewrite for the login url. For example, rewrite wp-login.php to login.

    I appreciate any help with this. Thanks a lot.

  2. I tweaked your plugin to allow me to do some internal redirects. I recently converted my site from Joomla to WP and I have a lot of old references hitting my site that I want to maintain.

    So, I use a joomla URL – ie /resume.html and using your plugin I redirect it to the wordpress location.

    I added an else at the bottom,
    else {
    header(“Location: “.site_url().$file.”\r\n”);
    }

    Works perfectly :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>