Configure Nginx for Wordpress Permalink
1 min readJun 15, 2021
Hello I’m Jamal
in one case, I installed wordpress on the nginx web server, and I get the problem when trying to create seo frendly permalinks.
by default permalinks in wordpress will use links like this
The default WordPress permalinks are not SEO friendly. Which is not good for the SEO for your application. You need to change permalinks settings to make URLs SEO friendly. To change permalinks, Login to admin panel >> Settings >> Permalinks option.
Default Permalinks:
SEO Friendly Permalinks:
- https://example.com/post-name
- https://example.com/category/post-name
- https://example.com/2020/01/22/post-name
And here is configuration nginx for permalinks wordpress
Open the configuration in your terminal:
nano /etc/nginx/sites-available/example.comserver{ root /var/www/example.com/html; index index.php index.html index.htm index.nginx-debian.html; servername example.com www.example.com; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; } location ~ /\.ht { deny all; }}
Save your file and reload the Nginx service.
sudo systemctl reload nginx