Pretty URLs (clean addresses)
Turn on clean, SEO-friendly addresses like /post/my-title in Blog Lite 2. Setup for Apache with mod_rewrite and for Nginx, plus troubleshooting.
By default, Blog Lite 2 works on every server with addresses like yoursite.com/index.php?route=post/my-title. Pretty URLs turn them into yoursite.com/post/my-title, which are easier to read, share and remember.
| Page | Default address | Pretty address |
|---|---|---|
| Article | index.php?route=post/my-title | /post/my-title |
| Category | index.php?route=category/travel | /category/travel |
| Tag | index.php?route=tag/recipes | /tag/recipes |
| Contact | index.php?route=contact | /contact |
On Apache
The included .htaccess file already contains the rewrite rules. You only need:
- Apache with
mod_rewriteenabled (standard on almost all hosting). AllowOverride Allfor your folder, so.htaccessis read. On shared hosting this is normally already set.- Go to Settings → General, switch Pretty URLs on and save.
- Open your blog and click a post to test it.
On Nginx
Nginx ignores .htaccess, so add this to your server configuration (adjust paths if the blog is in a subfolder):
location / {
try_files $uri $uri/ /index.php?route=$uri&$args;
}
# keep private folders private
location ~ ^/(data|app|admin/views)/ { deny all; }
location ~* ^/uploads/.*\.php$ { deny all; }
Reload Nginx, then switch Pretty URLs on in the settings. Make sure your location ~ \.php$ block for PHP-FPM is also in place.
If the public pages show "not found"
Do not panic
The admin panel does not use pretty URLs, so you can always log in at yoursite.com/admin/ and switch the option off again.
- Check that
mod_rewriteis on and the.htaccessfile was uploaded (some FTP programs hide files starting with a dot). - Ask your host to enable
AllowOverride All. - Test on Nginx: confirm the
try_filesline is inside the rightserverblock.
Other things to know
- The addresses of your RSS feed and sitemap change too. See RSS feed and sitemap.
- If you change this option on a live blog, update the sitemap in Google Search Console.
- The address of an article is created from its title when you first save it. You can edit it in the post editor. See Writing posts.
Last updated