By default WordPress uses web URLs which have question marks and lots of numbers in them that looks ugly. e.g. http://example.com/?p=123
WordPress offers you the ability to create custom URL structure for your permalinks and archives, which improves the readability, and forward-compatibility of your links e.g. http://example.com/category/post-name or http://example.com/year/month/day/post-name. To enable permalinks you first need to enable mod_rewrite for Apache. In Ubuntu execute the following:
$ sudo a2enmod rewrite
In the Apache configuration file, the FollowSymLinks option needs to be enabled and the FileInfo needs to be allowed for the WordPress’s home directory.
<Directory /var/www/wordpress>
Options FollowSymLinks
AllowOverride FileInfo
allow from all
</Directory>
Create a .htaccess file inside the WordPress’s home directory and set read/write permission to it.
$ cd /var/www/wordpress
$ touch .htaccess
$ chmod 666 .htaccess
In the WordPress Dashboard navigate to “Settings” > “Permalinks”
Specific the URL structure which you desire, and click on the “Save Changes” button.
For security purposes remove the write permisson on the .htaccess file
$ chmod 644 .htaccess
Related posts:
