Things I want:
To 301 redirect /file_new.pdf to /file new.pdf ( %20 also known as space between file and new )
I am conscious that:
- I'm able to depend on RewriteRule 301 which utilizes mod_rewrite, utilizing a solution out of this thread: @ http://stackoverflow.com/questions/410811/modrewrite-with-spaces-in-the-urls
- I'm able to relabel the file not to include spaces and replace all of them with dashes/underscores
However, I am personally curious regarding how you might do that. This is what I've to date:
Redirect 301 /file_new.pdf http://sitename.com/file\ new.pdf
The conf file parser throws a mistake after i invoke the configtest:
Redirect takes 2 or 3 arguments, an optional status, then document to be rerouted and destination URL
Edit: Apparently the mod_rewrite nor Redirect 301 techniques will work for me personally, possibly because for reasons uknown they are not using since the file really is available for the reason that location.
<VirtualHost *:80> DocumentRoot /www/sitename_com ServerName site.local Options -MultiViews RewriteEngine on Redirect 301 /pdf/file_new.pdf http://site.local/pdf/file%20new.pdf RewriteRule ^/pdf/file_new.pdf http://site.local/pdf/file\ new.pdf RewriteLog "/www/rewrite.log" </VirtualHost>
In rewrite.log, it attempts to match the pattern to every particular uri / http request.. I believe something is taking charge before it even reaches the mod_alias/mod_rewrite stuff.
So in summary, it is going straight to file_new.pdf within the browser and does not 301. I am positive that
rewrite are enabled. My apache version is 2.2.
Redirect is really a part of mod_alias, not mod_rewrite. i am glad the %20 labored and you will also employ quotes to inform apache the path which includes the area may be the Hyperlink to redirect to and never two separate products:
Redirect 301 /pdf/file_new.pdf "http://site.local/pdf/file new.pdf"