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.


After you enable pretty URLs, webtrees still recognise the default URLs. So any bookmarks and search-engine links will still work.

Recognising URLs from webtrees 1.x and phpGedView

webtrees is able to recognise the URLs generated by these older applications. So bookmarks and search engine links to {base_url}/individual.php?pid=XXX&ged=YYY will be automatically forwarded to {base_url}/tree/YYY/individual/XXX.

Note that this will not work for relative URLs that you may have embedded in HTML blocks on your home pages. e.g. <a href="individual.php">...</a>. You will need to edit these manually.

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

Does your server support .htaccess files? To test this, try to view your webtrees configuration file in your browser (e.g. https://<>/data/config.ini.php). If .htaccess files are supported, you will get 403/Access-denied error. If not, you will see a page containing just a semicolon.

Store the following .htaccess file in the webtrees folder.

<IfModule mod_rewrite.c>
  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