Guys and Gals i have a vBulletin forum and I am having some issue with our tag clouds.

currently the tag link looks like this

http://www.site.com/tags.php?tag=green+data+center

But we want to get it like this

http://www.site.com /tags/green-data-center.html

So I have used this

RewriteRule ^tags\.php\?tag=(.+)$ tags/$1.html

but there seems to be no effect. pls tell me how to get this work?

Member Avatar

diafol

RewriteEngine On
RewriteRule ^tags/([^/]*)\.html$ /tags.php?tag=$1 [L]

will give

http://www.site.com /tags/green+data+center.html

I'm not sure how to replace + with - though.

However, I did come across this for replacing a space with an underscore:

http://www.unitedforums.co.uk/vb/website-development-scripting/8920-mod_rewrite-replace-1-more-instances-character.html

RewriteCond %{REQUEST_URI} ^(.*)\ (.*)$
RewriteRule ^.*$ %1_%2 [E=space_replacer:%1_%2]
RewriteCond %{ENV:space_replacer} !^$
RewriteCond %{ENV:space_replacer} !^.*\ .*$
RewriteRule ^.*$ %{ENV:space_replacer} [R=301,L]

Perhaps you could modify this? Not sure wether it would replace all instances though