Support » Fixing WordPress » Some mod_rewrite help please.

  • Hi,
    I’d like to know how to convert the new WP urls, to those used by my old MT installation.
    The old MT URL:
    The new WP URL:
    Notice the “-? instead of “_? in the WP URLs.
    This is what I have in my .htaccess mod_rewrite section.
    <pre>RewriteEngine On
    RewriteBase /
    RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([0-9a-z-]+)?/?([0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([0-9a-z-]+)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA]
    RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([0-9a-z-]+)/trackback/?$ /wp-trackback.php?year=$1&monthnum=$2&day=$3&name=$4 [QSA]
    RewriteRule ^archives/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?category_name=$1&feed=$2 [QSA]
    RewriteRule ^archives/category/?(.*) /index.php?category_name=$1 [QSA]
    RewriteRule ^archives/author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?author_name=$1&feed=$2 [QSA]
    RewriteRule ^archives/author/?(.*) /index.php?author_name=$1 [QSA]
    RewriteRule ^feed/?([0-9a-z-]+)?/?$ /wp-feed.php?feed=$1 [QSA]
    RewriteRule ^comments/feed/?([0-9a-z-]+)?/?$ /wp-feed.php?feed=$1&withcomments=1 [QSA]
    As you may have gathered, what I want to do is instead of WP converting spaces in post titles to “-“, I would like them converted to “_”.
    Can anyone please help?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Anyone at all know?
    I’ve searched this forum several times, but never find a real definitive answer to this problem. And the threads that have discussed this previously all end without a solution.
    Please help.

    Sadly, this isn’t a mod-rewrite problem but a php problem. To fix this you would have to locate the function adding those hyphens and correct that. I searched for a few minutes but couldn’t find anything.
    Let me say that I do understand what you’re saying. When I fired up WP for the first time I wanted underscores too. But because I didn’t have to worry about maintaining permalinks and I remember reading somewhere that google apparently prefers hyphens to underscores, I let it go.
    But could I suggest that this be added to WP’s permalink settings? This could be very important for migrating weblogs.

    the advantages of having post slug field i assume!

    Thanks allusion, but that didn’t work… I got 404’s… is it possible that using the SQL query also needs some editing of the mod_rewrite stuff?
    I’m not too worried about future links, but my past links drove plenty of traffic to my site… so had that suggestion worked I would have been totally happy.
    Thanks again,
    PS: I agree with Stevarino, this might be a good option to include for those users that are thinking of moving from MT to WP.

    I forgot the mod_rewrite rules had been changed in the CVS.
    In all the rules.

    And this has now been included in the CVS.

    ok, I’m running the latest CVS, and have replaced the old mod-rewrite stuff in my .htaccess file with the new stuff … and now get an error 500 every time.
    So I’ve gone back to the old .htaccess stuff, and am still running the new CVS copy and it works fine.?.
    I’m beginning to think I’m cursed. 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Some mod_rewrite help please.’ is closed to new replies.