How to use slashes in WordPress permalinks?

Viewed 2009

I am migrating an old website to WordPress. I have to migrate about 100,000 pages. I have written a plugin which is making use of wp_insert_post.

I also want to migrate the old URL structure without making use of redirects (because every 301 redirect is said to loose some link power), but use permalinks instead. Whenever I set a permalink which includes a slash (directory structure), the slashes are replaced with '-'. This is the problem.

wp_insert_post(array=>('post_name' => 'slashes/go/there/'));

permalink = 'slashes-go-there-';

Any ideas how i can set permalinks on a individual basis for every single page would be appreciated?

2 Answers

The simplest way to make your page url like www.example.com/se/se1 instead of www.example.com/se1 is to create page se and se1 make as child page of se.

With this option you'll saved your wordpress website permalink structure, you'll in not need to change your other pages redirects for google indexing

Finally I mangaged to solve the problem. Solution:

  1. Install a wordpress plugin: Custom Permalinks from Sami Ahmed Siddiqui

  2. Writing an entry to metadata to set the permalink:

    update_post_meta($wpid, 'custom_permalink', $url);

Related