WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Post slug customization

[Resolved] Post slug customization

Viewing 14 replies - 1 through 14 (of 14 total)
  • Seems like an odd thing to do, but have you tried using the html entities rather than straight hyphens?

    It’s &#45 ; (without the space before the semicolon).

    I tried to modify one of my post slug like this: unique&#45 ;&#45 ;&#45 ;book (without the spaces)and the new url was “uniquebook”. I’m not sure if that’s what you mean but it didn’t work that way.

    Can I edit a php file to change the way the post slug is written? Anyone know which file is that?

    May I ask why you’re trying to do this? This isn’t an implied criticism, it’s just that sometimes there are other strategies to achieve a certain goal.

    I have a blog and it uses a blog script that you can not import into wordpress. I have more than 1000 posts there and some url’s are written like: http://myblog.com/like—this/

    I worked really hard to have each url posted on other sites and that’s why I can’t change their name at all.

    If only some of the URLs are written like that then it’s very feasible put 301 redirects in your htaccess file and people (and your pagerank) will be seamlessly redirected to the new pages. Actually it would be feasible to do this even if all 1000 posts were like that, but it would be more work!

    Thanks man. I didn’t know that was possible, so, for a url like http://myblog.com/07/2007/like—this.html the syntax should be something like the following?

    redirect /07/2007/like—this.html http://myblog.com/newdironlyone/like-this.html

    ?

    Thanks again.

    Yes, but use RedirectPermanent instead of just redirect. Google needs to know that the page has permanently and not just temporarily moved.

    And just one space between the old and new urls (you may have done that in your example — it’s hard to tell

    This is a much better solution than hacking the core files, which causes problems every time you upgrade WP!

    Thanks a lot. I found out which php file I’d have to edit but your suggestion is better indeed.

    Nifty solution

    I didn’t know how to set up a Redirect anyway, just learned something from that

    When I started switching a static site to wordpress I tried to find ways to recreate all the old URLs, down to recreating the .html extensions. Unfortunately with Pages this involved hacking the core files, so with some nervousness I went for having an .htaccess file with about 600 redirects. It worked like a dream and traffic actually increased.

    Hey dude, What else I should put in my htaccess to even install wordpress? I just put the redirects but i can’t install the script, getting a internal error because of that.

    You may have to hit the “update permalinks” button in your permalinks options if you’ve overwritten the existing htaccess file. Or maybe you need to create a new page. I know squat about that kind of stuff apart from adding a few redirects.

    For the record, what I did in my case was copy and rename the htaccess file on the server, download it, add my redirects, rename it to .htaccess again, and upload it by ftp. That preserved all the WordPress htaccess stuff.

    Everything worked just fine, except for one time I’m missed a space in a redirect rule and the whole site 500’d. That was a scary moment.

    For those of you looking to edit the main WP code (like I was) to get it to work the way YOU want it:

    (wp 2.3.2) Look at file wp-includes\taxonomy.php

    And mod this:

    function wp_unique_term_slug

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Resolved] Post slug customization’ is closed to new replies.
Skip to toolbar