I have a link from anther website that I do not have control of http://example.com/one two three.exe
The correct URL is http://example.com/one_two_three.exe
Note the underscores instead of spaces.
I searched the internet and found this code snippet for .htaccess
# Redirect old file path to new file path
Redirect /one%20two%20three.exe http://example.com/one_two_three.exe
I added this snippet to my preexisting root .htaccess at the top of the file.
But it does not seem to work. My browser does not redirect and I get a 404 error page.
I believe that it has something to do with the spaces in the original URL but I don't know how to handle spaces in the URL.
Suggestions?
A 301 Permanent Redirect permanently redirects one URL to another. You set up a 301 redirect using . htaccess to send visitors to a new URL and tell search engines that a page has moved so that the new page can be properly indexed. Some common uses of a 301 redirect with .
You could try a couple of things (both untested)
Redirect "/one two three.exe" http://example.com/one_two_three.exe
or use RewriteRule
instead of Redirect
:
RewriteRule /one\ two\ three.exe http://example.com/one_two_three.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With