Hypernode makes use of Nginx. Nginx does not use
.htaccess files like Apache does. This means that configuration previously done in
.htaccess files now has to be done in a different format, explained in the nginx documentation.
Generally you want rewrite rules if you have moved (parts of) your site to a different folder or URL.
The rewrite rules below should be added to a file called
server.rewrites in the
nginx folder on your Hypernode account.
They are used when you want to rewrite within the same domain. For example, to rewrite all URLs in the format of
/invoice.php?id=345232 you would use this rewrite line:
rewrite ^/invoice/(\d+).pdf$ /invoice.php?id=$1 break;
This will handle the rewrite internally, so it is transparent for browsers and search engines.
If you have moved content between domains, or want to signal (for example to search engines) that something has moved, you should use an external redirect.
For example, you want every URL starting with /fr to redirect to http://yourshop.fr:
rewrite ^/fr/(.*)$ http://yourshop.fr/$1 permanent;
This will also maintain subfolders and query strings (such as
If the move is only temporary, you should use
redirect instead of
- Hypernode: how to force all traffic to use HTTPS
- Hypernode: how to block or rewrite based on visitor country
- Nginx reference manual on rewrites