Forum Moderators: open

Message Too Old, No Replies

Set URL structure for WordPress using category ID

         

Erku

5:50 pm on Apr 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




System: The following 3 messages were cut out of thread at: http://www.webmasterworld.com/community_building/3635606.htm [webmasterworld.com] by encyclo - 4:43 pm on April 27, 2008 (utc -4)


Hello everyone,

since this is a WP forum, is there a tag for category IP in WP?

We want to mod rewrite in this way

mysite.com/21/124.html

21 is the name of the category
124 is the article ID

How can I make that kind of mod rewrite?

Any help will be greatly appreciated.

thank you

himalayaswater

6:39 pm on Apr 27, 2008 (gmt 0)

10+ Year Member



Category id is not supported under Wordpress but you can get Category name:

Goto Settings > Permalinks > Custom Structure

/%category%/%post_id%.html

Save the changes. You must have .htaccess and mod_rewrite enabled. See offical docs for more info - [codex.wordpress.org...]

Erku

7:51 pm on Apr 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I really do need category ID, because in my previous website, where I am moving from to WP the urls are like this

mysite.com/21/124.html Is this not possible at all? Is there a work around it?

himalayaswater

4:49 am on Apr 28, 2008 (gmt 0)

10+ Year Member



Noop, not possible until and unless you make changes to worpdress code or write a plugin.

lexipixel

5:53 am on Apr 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you really want to preserve such bad, ugly, non-SEO'd URLs ?


21 is the name of the category

If "21" is actually the name of the category, (and not an "ID" for the category), it will work -- but I assume that is not what what you meant...

Anyway, if you really need to preserve the CATEGORY ID (number) as part of the URL, here's a possible (although complicated) work-around;

You could create WP categories named "21, 22, 23, etc..", then create another set of categories with the actual names... each post would need to posted to "multiple categories" and the permalinks would use the lowest category ID's, (the numbers if you create them first)...

You might get some better idea from:
[codex.wordpress.org...]