Welcome to WebmasterWorld Guest from 174.129.96.175

Forum Moderators: Ocean10000 & incrediBILL & phranque

Mod Rewrite Rules for custom URL structure

   
1:15 pm on May 9, 2012 (gmt 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:

http://example.com/p=14

to

http://example.com/category/post-name

But what I want is:

http://example.com/category-post-name.html

Or, even better,

http://example.com/keyword-category-post-name.html

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)

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



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)

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




But what I want is:

http://example.com/category-post-name.html


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!
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month