Last Updated:

How to 301 redirect a PDF file with mod_alias and mod_rewrite

Kalee Raisor
Kalee Raisor Webmaster Tips

Here's some quick information on how to use an Apache .htaccess file to do a 301 redirect with either mod_rewrite or mod_alias. This method should also work for .doc and .docx files as well.


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/old/path/file.pdf$
RewriteRule ^(.*) /new/path/file.pdf [L,R=301]


Redirect 301 /old/path/file.pdf /new/path/file.pdf