Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Mod Rewrite Rules for custom URL structure

1:15 pm on May 9, 2012 (gmt 0)

New User

joined:Dec 28, 2011
posts: 5
votes: 0

I have a wordpress site and would like to setup custom URLs. Normally, I can use the wordpress permalinks settings to take a URL like:




But what I want is:


Or, even better,


To be clear, "keyword" would always be the same for every URL. It's not a variable.

Getting the .html to show up is no problem, the parts I'm having a problem with are getting the keyword to be inserted in all the URLs just before the category name, and to remove the / that normally would be between the category and post / page name.
10:40 pm on May 9, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
votes: 244

For starters: WordPress is tricky (some people may use a stronger word) because it probably comes with its own htaccess. So you have to be very careful to ensure that your own additions don't conflict with what is already there.

How do you get from the single item "p=14" to the two items "category" (or "keyword-category") and "post-name"? Once you've figured this out, the choice between / and - is simply punctuation. In fact it's a good idea to make the change, if /category/ isn't really a directory (real or fake doesn't matter).

Someone else is going to read you the riot act about appending ".html" when it isn't already there from natural causes ;)
11:18 am on May 10, 2012 (gmt 0)

Administrator from US 

WebmasterWorld Administrator incredibill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 25, 2005
votes: 88

But what I want is:


No. You don't.

People remove .html from their sites, not add it.

I made two sites extensionless just this week.

No extensions whatsoever should be exposed if possible.

The real upside to going extensionless is you can change the technology under the site at any time because it doesn't matter if it's .html, .php, .asp, .pl, .jsp or whatever and there is certainly no need to tell hackers so they have an easy clue how to start attacking.

Maybe Tim Berners-Lee's article at the W3C will convince you.
He's just the guy that invented the web, but what does he know?
[w3.org...] <-no file extension at w3c, shock!