htaccess and wordpress help

fatmoocow

Señor Member
Feb 1, 2009
480
9
0
Ok, I'm feeling retarded today. I'm converting a friends blog to wordpress.

It has retarded urls in this format: url.tld/blog/Keywords+Galore!

Once imported they are now: url.tld/blog/keywords-galore/

What I need is wordpress to accept either format because this blog is quite old, has plenty of links and bookmarks which need to still work.

Any ideas? I'm thinking this can be done with htaccess, but I can't seem to find a good example. Just need to replace the "+" and strip out any dumb characters that wordpress would normally dump as part of an import.

Hopefully this will jog the memory:

1278507040815.jpg
 


What you need to do is take the two keywords, slather them in sunscreen and slide your cock between them until ... no wait, wait. Shit. Sorry.

Try a variation on this:

.Htaccess rewrites, Mod_Rewrite Tricks and Tips

It uses mod_rewrite to change underscores to hyphens, which with some tweaking ought to do what you're trying to do.


Frank
 
  • Like
Reactions: fatmoocow
ugh so close

This is what I got, but I'm running into an infinate loop

site.com/some-keywords/some-keywords/some-keywords...

Code:
Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ $1-$2-$3-$4-$5 [E=plus:Yes] RewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ $1-$2-$3-$4 [E=plus:Yes] RewriteRule ^([^\+]*)\+([^\+]*)\+(.*)$ $1-$2-$3 [E=plus:Yes] RewriteRule ^([^\+]*)\+(.*)$ $1-$2 [E=plus:Yes] RewriteCond %{ENV:plus} ^Yes$ RewriteRule (.*) http://www.url.com/$1 [R=301,L]     # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>  # END WordPress
 
YESSSS!!!

GOT IT!

rewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ http://www.url.com/$1-$2-$3-$4-$5-$6-$7-$8-$9-$10 [R=301,L]
rewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ http://www.url.com/$1-$2-$3-$4-$5-$6-$7-$8-$9 [R=301,L]
rewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ http://www.url.com/$1-$2-$3-$4-$5-$6-$7-$8 [R=301,L]
rewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ http://www.url.com/$1-$2-$3-$4-$5-$6-$7 [R=301,L]
rewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ http://www.url.com/$1-$2-$3-$4-$5-$6 [R=301,L]
rewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ http://www.url.com/$1-$2-$3-$4-$5 [R=301,L]
rewriteRule ^([^\+]*)\+([^\+]*)\+([^\+]*)\+(.*)$ http://www.url.com/$1-$2-$3-$4 [R=301,L]
rewriteRule ^([^\+]*)\+([^\+]*)\+(.*)$ http://www.url.com/$1-$2-$3 [R=301,L]
rewriteRule ^([^\+]*)\+(.*)$ http://www.url.com/$1-$2 [R=301,L]
 
<3 Shay

I was gonna recommend the redirection plugin for wordpress, but if you had a ton of posts then hookin up the htaccess for it is the wya to go