Buy me a coffee

Replace PDF URL with a nice URL

By default, when opening a PDF file, it will open a long URL like this: https://static1.squarespace.com/static/644f2654b9c076768430cf4b/t/65af6a17e2c4821faedba955/1705994779057/book.pdf (this is just an example URL so it doesn’t exist, no need to click it)

We can use a trick to change it to something like this: yourdomain/pdf/book

#1. First, you need to get a PDF URL

#2. Create a Page with

  • Name: you can enter anything
  • URL: /pdf/book

Replace Pdf Url With A Nice Url 01 Min

#3. Use this code to Page Header Code Injection

Replace the PDF URL in the code with your PDF file URL.

<iframe src="https://static1.squarespace.com/static/644f2654b9c076768430cf4b/t/65af6a17e2c4821faedba955/1705994779057/book.pdf">
  
</iframe>
<style>
iframe {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  }
</style>

Replace Pdf Url With A Nice Url 02 Min

#4. Result

Replace Pdf Url With A Nice Url 03 Min