Readymag Guide
Did you meanShowing results for {{correction}}?
Nothing found for {{query}}
{{post.parent_title != '' ? ' • ' + post.parent_title : ''}}
Need help? Contact Readymag support
{{post.parent_title != '' ? ' • ' + post.parent_title : ''}}
Show {{results.length - SHORT_LIMIT}} more results

Code Export#

You can download the source code of any project to host it on your own servers. The process takes three steps:

  1. download the source code,
  2. upload it to a remote server,
  3. configure the server.

Please, note that projects will not work without the third step — if you simply upload them without configuring the server.

  • Typekit fonts will not work if you open a project from a file on your device. 
  • Readymag Form widget can only send data to a custom URL. Google Docs, Email and Mailchimp options will not work in exported projects.
  • Custom OG tags and SEO tags are not exported for any page except the first one (meta tags stored in index.html).
  • Exported projects cannot be changed. The content is encoded in JSON format and rendered on a page via javascript. If you need to make changes, find the project in your account, make changes, republish and export again.

Step 1: download the source code

To get project’s source code you need to publish it first. The download link appears in the settings. Specify the domain where the project will be hosted in the dialog box. This is necessary for third-party integrations to work (like Typekit webfonts).

Step 2: upload the archive to a remote server

In the downloaded archive you’ll find the following files and folders:

File Description
robots.txt pre-defined settings for web crawlers
build  stylesheets, templates and scripts
img  all images used in the project
snippets  static contents of all pages for search crawlers
index.html  project page, contains the content of the project encoded in JSON format
sitemap.xml  list of available links for search crawlers
sorry.html  custom page for unsupported browsers
nginx_rmwebsite.conf  sample configuration file for NGINX servers 
.htaccess  sample configuration file for Apache servers 

Folders, containing project assets (build, img, snippets), and index.html are required. Other files can be omitted if you don’t need them.

Step 3: configure your server

We provide sample configuration settings for NGINX and Apache servers.

server { listen 80; server_name nightcities.readymag.com; # Change path to folder with downloaded source root "/path/to/project_folder"; index index.html; access_log off; autoindex off; charset utf-8; location / { if (-f $request_filename ) { break; } if ($args ~ "_escaped_fragment_") { rewrite ^/([.a-zA-Z0-9-]+)/? /snippets/$1.html last; rewrite ^/ /snippets/1.html last; } location = / { if ($args ~ "_escaped_fragment_") { rewrite ^/ /snippets/1.html last; } } rewrite ^/?$ /index.html last; rewrite ^/[.a-zA-Z0-9-]+(/(.*))? /$2 last; try_files $uri $uri/; } } Options FollowSymLinks SymLinksIfOwnerMatch AddDefaultCharset utf-8 AddType application/vnd.ms-fontobject eot AddType font/opentype otf AddType font/truetype ttf AddType application/font-woff woff AddType video/webm webm RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} _escaped_fragment_ RewriteCond %{REQUEST_URI} !^/(build|img|snippets|config) RewriteRule ^([.a-zA-Z0-9-]+) snippets/$1.html [L] RewriteCond %{QUERY_STRING} _escaped_fragment_ RewriteCond %{REQUEST_URI} !^/(build|img|snippets|config) RewriteRule ^ snippets/1.html [L] RewriteCond %{REQUEST_URI} !^/(build|img|snippets|config) RewriteRule ^/?$ index.html [QSA,L] RewriteCond %{REQUEST_URI} !^/(build|img|snippets|config) RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^[.a-zA-Z0-9-]+(/(.*))? $2 [QSA,N]

If you host your website on an Apache server, chances are the .htaccess configuration will take effect automatically. Make sure you uploaded the .htaccess from the exported archive to your web server: on MacOS, .htaccess is hidden. If the .htaccess configuration does not work (typical symptom: pages other than first return 404 on refresh), ask your hosting provider to enable .htaccess.

If you host your website on your own NGINX server, you can either copy and paste nginx_rmwebsite.conf contents into your main nginx.conf or include nginx_rmwebsite.conf into nginx.conf with an “include” directive. If the NGINX you host on is not your own, ask your hosting provider to apply the configuration from nginx_rmwebsite.conf for you.

If you don’t have access to your NGINX or Apache server, contact your hosting provider to configure the files according to the examples provided above. Without configuring the server properly, the project won’t work, even if you’ve uploaded all of the required files.

How it works

Below is the explanation of how routing works in Readymag projects. All paths in the code are relative: your server needs to be configured to serve them.