Skip to main content

FAQ - How do I enable pretty URLs?

How do I enable pretty URLs?

Default URLs look like:

Pretty URLs look like:

To enable “pretty URLs”, you need two things.

Firstly, you must configure your web-server to accept pretty URLs, and forward them to webtrees. The exact configuration will be different for every server. The basic setup is:

  • Static files are kept in /public. These can be served directly, using long expires headers.

  • Dynamic pages are generated by index.php. All non-static URLs should be mapped onto /index.php.

  • Other files and folders are private, and should not be made available. e.g. /app, /data, /modules, /resources, /vendor.

Secondly, you must tell webtrees to generate pretty URLs. You do this by adding/changing two lines in the file data/config.ini.php.


Example configuration for NGINX

Here is an example NGINX configuration for webtrees installed in a subfolder /webtrees/.

# Static files have versions in their URLs, and can be cached indefinitely.
location /webtrees/public {
    expires 365d;
    access_log off;

# GIT config files can contain credentials or other sensitive data.
location /webtrees/.git {
    deny all;

# User data is stored here by default.
location /webtrees/data {
    deny all;

# Nothing sensitive here, but there is no need to publish it.
location /webtrees/app {
    deny all;
location /webtrees/modules {
    deny all;
location /webtrees/resources {
    deny all;
location /webtrees/vendor {
    deny all;

# Rewrite all other requests onto the webtrees front-controller.
location /webtrees/ {
    rewrite ^ /webtrees/index.php last;

# webtrees runs from this one script.
location = /webtrees/index.php {
    include fastcgi.conf;
    fastcgi_pass unix:/run/php/php7.3-fpm.sock;

Example configuration for Apache

Store the following .htaccess file in the webtrees folder.

RewriteEngine On
RewriteBase /webtrees/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Change the entry for RewriteBase to match the folder part of your webtrees URL.

Edit this page