Im trying to replace all %20 with + signs but just when the url starts with /some/dir/. For example:
http://mydomain.com/some/dir/replace%20here
should be redirected to
http://mydomain.com/some/dir/replace+here
but
http://mydomain.com/test/dir/replace%20here
should not replace the %20
So far I have:
RewriteCond %{REQUEST_URI} ^(/some/dir/)
RewriteRule ^([^\s%20]+)(?:\s|%20)+([^\s%20]+)((?:\s|%20)+.*)$ $1$2+$3 [N,DPI]
RewriteRule ^([^\s%20]+)(?:\s|%20)+(.*)$ /$1+$2 [L,R=301,DPI]
but that stills replaces the %20 in /test/dir
What am I missing?
Thanks!
Your rules are not correct and moreover
DPIflag is not supported in all Apache versions. Change your Rewrite rules to this: