Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our marketing dept sent out an email with dozen of PDF's. We sent out an email containing HTTP links to PDF documents that are hosted on our server.

We now are moving the destination to another location.

current settings:

  • Apache/2.2.24
  • PHP 5.3.24

  • is it possible to redirect the destination without sending the email again to all recipients?

My current .htaccess looks like this (in the root of the file folder)

<IfModule rewrite_module>
     RewriteEngine On
     Redirect /9/91/Demo.pdf
     RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]
     RewriteRule . - [forbidden] 
  • But I always get the Demo.pdf file

If I want to redirect: to --->

what should be the command?

share|improve this question
Depends on your web server or app server, whatever. – devnull Jul 23 '13 at 9:16
I'M assuming they've sent out an email containing HTTP links to PDF documents that are hosted on some server? – Oliver Salzburg Jul 23 '13 at 9:52
This depends mostly on the web server you're using (like IIS, Apache, ...). Knowing that, it shouldn't be a problem to implement a redirect from one URL to another. – Oliver Salzburg Jul 23 '13 at 10:26
Cool URIs don't change. – Michael Kjörling Jul 23 '13 at 13:57
up vote 3 down vote accepted
  1. In the root of your documents folder of the webserver, place a new .htaccess file (or modify the existing one, if you've already created one in the past).

  2. For every .pdf document, place a line in the .htaccess file with the following syntax:

    Redirect 301 /pdf/some-document.pdf

The Redirect directive requires mod_alias to be loaded (it usually is).

The 301 indicates that this is a permanent redirection (in contrast to 302, which would be a temporary redirection). After that is the old path of the document (relative to the location of the .htaccess file). And the last argument is the new location of the file.

Be sure to restart Apache after adjusting the .htaccess file, as it is most likely cached.

share|improve this answer

Create a folder with name as "oldfile.pdf" create an index.php file in it and add this code:

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location:" );
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .