wouldnt be easier just to change the preg_replace line in the new plugin that uses _ to + ??
I was thinking about that – but the thing is I’d need to replace it every single time I installed an updated version of that new plugin.
uh, yeah, and? it’s one line 🙂 and plugins arent really upgraded that frequently. Up to you I spose.
found via google, I tested it and it works for me:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule !\.(php)$ - [S=5]
RewriteRule ^tag/([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ tag/$1+$2+$3+$4+$5+$6+$7 [E=underscores:Yes]
RewriteRule ^tag/([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ tag/$1+$2+$3+$4+$5+$6 [E=underscores:Yes]
RewriteRule ^tag/([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ tag/$1+$2+$3+$4+$5 [E=underscores:Yes]
RewriteRule ^tag/([^_]*)_([^_]*)_([^_]*)_(.*)$ tag/$1+$2+$3+$4 [E=underscores:Yes]
RewriteRule ^tag/([^_]*)_([^_]*)_(.*)$ tag/$1+$2+$3 [E=underscores:Yes]
RewriteRule ^tag/([^_]*)_(.*)$ tag/$1+$2 [E=underscores:Yes]
RewriteCond %{ENV:underscores} ^Yes$
RewriteRule (.*) http://www.YOURDOMAIN.com/$1 [R=301,L]
With the plugin weighing in at over 5k lines of code across about 6 php files I have no way of guaranteeing that just searching for preg_replace will really do it. 🙂
I knew that .htaccess would be a much quicker way of doing it I just was having trouble getting the syntax down. The solution I finally found was close to the one your suggested but a bit simpler. Here’s what I went with:
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^tag/(.*)\+(.*)$ http://example.com/tag/$1-$2 [R=301,L]
RewriteRule ^tag/(.*)_(.*)$ http://example.com/tag/$1-$2 [R=301,L]
I only needed one RewriteRule because none of my tags are longer than two words. Once I got it figured out I added the last line to make everything more SEO friendly.
In its current form the code above replaces both ‘+’ and ‘_’ with ‘-‘ making things pretty simple.
Thanks for jumping in to help whooami, I appreciate it! 🙂