I need to redirect automatically lots of url like /file%20name/ ore /file name/ to /file+name/ or /file-name/.
How can I do this with .htacess ?
Try this rule in your .htaccess:
RewriteEngine on
Options +FollowSymlinks
# executes repeatedly as long as there are more than 1 spaces in URI
RewriteRule "^(\S*)\s+(\S* .*)$" $1+$2 [N,NE]
# executes when there is exactly 1 space in URI
RewriteRule "^(\S*)\s(\S*)$" /$1+$2 [L,R=302,NE]
R=301 will redirect with https status 301
L will make last rule
NE is for no encoding URI
You can use something like this:
RewriteRule file\ name\ http://example.com/file+name [R=301,NC,NE,L]
Edit after comment:
Try this:
RewriteRule ^([^\ ]*)\ (.*)$ $1-$2 [E=rspace:yes,N]