I've tried for a month, numerous items, different strings, PHP, etc. nothing, NOTHING! I need help please PLEASE... The bots keep wanting to look at my forums old _ in the link and not the new -.
Context:
I switch my forum from underscores to hyphens. Trouble is, I can't get the htaccess to 301 redirect so it now looks like I have duplicate content.
Here's what I've done:
Redirect 301 /forum/Buy_Sell_Trade_Forums_C15/
http://www.discusswireless.com/forum...de-Forums-C15/
multiplied by all the different categories I have. This worked, however, it only worked for that directory and did not apply to forum categories and posts underneath it.
Another problem is the length of the posts will vary posts by post and forum by forum; I need a more efficient method of changing ALL _ to -
I've tried this piece:
RewriteRule ^forum/([^_]*)_([^_]*)_([^_]*)/([^_]*)_([^_]*)_([^_]*)/([^_]*)_([^_]*)_([^_]*)_([^_]*)/$ /forum/$1-$2-$3/$4-$5-$6/$7-$8-$9-$10/ [L,R=301]
But that's not working.....I'm looking for something to change everything in one swoop.
I could poetntially have links this long:
http://www.mysite.com/forum/Discuss-...-Strobe-P2523/
(of course with underscores)
Any htaccess gurus out there? I also tried this: RewriteRule ^/([-a-zA-Z0-9/]+)_(.+)$ /$1-$2 [L]
But that didin't work.....
ANd I've tried calling a script.php from htaccess in attempts to get it to work:
Code:
RewriteRule ^/forum/.+_.+ script.php
script.php:
Code:
$newUrl = str_replace('_', '-', $_SERVER["REQUEST_URI"]);
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . $newUrl);
Any thoughts at all? Someone must know, even a 'that's impossible :P" thanks.
Thanks in advance