1

I'm building a website and I was wondering if it is possible to exclude certain permalinks from beings used.

For example: if my website has a demo of a project running on www.example.com/demo/ and a user creates a page called demo, I don't want WordPress to create a permalink like www.example.com/demo/.

Is there a way to exclude these permalinks? So that WordPress will take the next available permalink? Like www.example.com/demo-2/ or something?

1

Interesting question. I found this post and tested, it worked for me:

http://wpdreamer.com/2012/03/how-to-define-reserve-slugs-for-wordpress-posts-and-pages/

If you don't want to edit your functions.php file an inelegant solution you can try is to create empty placeholder pages with the permalinks you'd like to reserve. If there is a physical directory on the server with that same name that would take precedence over the rewritten WordPress URL. So for example, if you create a WordPress page with slug "demo" and a physical directory in your web public dir called, "demo" you could use that for your demo site files.

Personally I like to use subdomains for this purpose myself to keep any demo work segregated from production, but that's just an opinion.

  • I prefer subdomains too, but it's for an existing website with some old projects that need to stay there for multiple reasons. But if it's possible with Wordpress, I'll give it a try. Thanks for the answer! – Frederik Voordeckers Jan 6 '14 at 8:35
  • I'm glad I could help! – nocabt Jan 7 '14 at 15:32
  • Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. See How to reference material written by others and How do I write a good answer? in the Help. – Pat J Jan 15 '14 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.