Reputation: 85
Basically my rewrite rules work fine but if I am working with files or folder with spaces in them it doesn't work and just returns 404/500 errors.
For example:
RewriteRule !^test/ test%{REQUEST_URI} [L]
RewriteCond %{THE_REQUEST} ^GET\ /test/
RewriteRule ^test/(.*) /$1 [L,R=301]
The above rule works perfectly fine. However if the file or folder has a space in it I would be using the following code:
RewriteRule !^test%20folder/ test%20folder%{REQUEST_URI} [L]
RewriteCond %{THE_REQUEST} ^GET\ /test%20folder/
RewriteRule ^test%20folder/(.*) /$1 [L,R=301]
But this just returns errors! I have also tried to removed the %20 and just have a blank space and that also returns an error.
Anyone know how to get around this?
Upvotes: 0
Views: 782
Reputation: 1041
Use \s (regexp white space) to match it or One\ Word\ And\ Another if you know the full string.
In your case:
^test\ folder/(.*)
Upvotes: 1