how to remove %20,:,/,? and many more from url with .htaccess? im already try code from this post, but still not replace/redirect to new url .htaccess url rewrite and removing %
Use this code , hope it will help you.
# remove spaces from start or after /
RewriteRule ^(.*/|)[\s%20]+(.+)$ $1$2 [L]
# remove spaces from end or before /
RewriteRule ^(.+?)[\s%20]+(/.*|)$ $1$2 [L]
# replace spaces by - in between
RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1-$2 [L,R]
NOte- Must add that you need to fix the source of these URLs also because it is really not normal to be getting URLs like this.
You can add these 2 rules before your last rewrite rule:
# replace %20 and / in QUERY_STRING by hyphen
RewriteCond %{QUERY_STRING} "^([^/]*?)(?:/|%20)+([^/]+?(?:/|%20)+.*)$"
RewriteRule ^ %{REQUEST_URI}?%1-%2 [N,NE]
RewriteCond %{QUERY_STRING} "^([^/]*?)(?:/|%20)+([^/]+?)/?$"
RewriteRule ^ %{REQUEST_URI}?%1-%2/ [L,R=302,NE]