How to Set Permalinks in WordPress Admin Dashboard?

Whenever a post or page is created, WordPress by default will save the URL in the format “http://www.yoursite.com/?p=1”. The last character indicates the post id, which will be added in a running sequence for each post or page.

Default WordPress URL Structure
Default WordPress URL Structure

But this URL format with post id does not provide any clue to users and search engines about the content on your page.

What is Permalinks?

In order to provide more descriptive URL structure, WordPress offers a solution called “Permalinks”. Permalink is the short form of permanent link since each post should be identified with an URL, which is permanent in nature. There are three types of permalinks in WordPress:

  • Default:

The structure of a default permalink will be your URL + post id as shown below:

http://yoursite.com/?p=123

where 123 is a post id. Default permalink structure is also known as “Ugly” structure since user does not understand what is 123 and where it is coming from.

  • Pretty Permalinks:

The descriptive URL containing useful information instead of post id number is also called as “pretty permalinks” in WordPress. Pretty permalinks are created using “mod_rewrite” module of an Apache server. Example of pretty permalink is:

http://yoursite.com/2014/10/28/post-name/
  • PATHINFO:

Pathinfo permalinks also known as “Almost Pretty” is same as pretty permalinks except the addition of “/index.php” in the URL. Example of PATHINFO URL is:

http://yoursite.com/index.php/post-name/

WordPress Pretty Permalinks Settings

Pretty permanent link structure for your site can be set by clicking on the “Change Permalinks” button shown next to the URL in the WordPress visual editor or by navigating to “Settings > Permalinks” options. Under “Common Settings” you will see many options to choose how you want your URLs to be saved in WordPress.

WordPress Permalink Settings
WordPress Permalink Settings

Each option will add some suffix to your site URL to create a post/page URL as below:

  • Default – adds post id to site URL.
  • Day and name – adds date of publishing in YYYY/MM/DD format and post name.
  • Month and name – adds month in the format YYYY/MM and post name.
  • Numeric – adds archives and post id.
  • Post name – adds post name.
  • Custom Structure – user defined.

All options other than “Default” option are considered as a “Custom Structure” by WordPress. For example if you select “Numeric” option WordPress will automatically fill “Custom Structure” field as “/archives/%post_id%”

WordPress Custom Structure Permalink
WordPress Custom Structure Permalink

Custom Structure Tags

Following tags are supported in the custom structure field:

TagDescriptionFormatTag ExampleExample Structure
%year%Year of post publishingYYYY2014/%year%/%postname%/
%monthnum%Month of post publishingMM10/%year%/%monthnum%/%postname%/
%day%Day of post publishingDD31/%year%/%monthnum%/%day%/%postname%/
%hour%Hour of post publishingHH16/%year%/%monthnum%/%day%/%hour%/%postname%/
%minute%Minute of post publishingMM45/%year%/%monthnum%/%day%/%hour%/%minute%/%postname%/
%second%Seconds of post publishingSS56/%year%/%monthnum%/%day%/%hour%/%minute%/%second%/%postname%/
%post_id%Unique id of the postN12/%year%/%monthnum%/%post_id%/
%postname%Name of the post as used in slugpost-namethis-is-my-post/%year%/%monthnum%/%postname%/
%category%Post Categorycategory-nameuncategorized/%category%/%postname%/
%author%Post Authorauthor-nameeditor/%author%/%postname%/

There is no need to enter your site URL, you only need to enter tag parameters and site URL will be added automatically to each post URL.

It is recommended to use custom structure suffixed with post id or post name to avoid interpretation issues. For example, using a custom structure like “%year%/%monthnum%/%day%/” for your post URLs will conflict with the archival URL for that day.

If your assign multiple categories or sub-categories to a single post, then the first category or sub-category in the alphabetical order will be added in the URL.

In order to activate PATHINFO start custom structure tag with index.php/.

Viewing Permalinks

Once permalink is activated you can see the URL structure when creating a post or page in visual editor as shown in the below picture. Just click on “Get Shortlink” button if you want to see the post id for any reason.

WordPress URL structure after activating permalinks
WordPress URL structure after activating permalinks

Optional Category and Tag Base Settings

All your category and tag URLs by default will be having the following format in WordPress:

http://yoursite.com/category/category-name/
http://yoursite.com/tag/tag-name/

You can modify these base words under “Settings > Permalinks > Optional”.

Permalinks for Tags and Category base settings
Permalinks for Tags and Category base settings

For example, if you enter “topics” as category base then the category URL format of your site will be changed as:

http://yoursite.com/topics/category-name/

In order to activate permalinks option, WordPress needs to have a write access to modify your .htaccess file.

You will see a message like “If your .htaccess file were writable, we could do this automatically, but it isn’t…” in your permalinks settings page if there is a permission error.

Provide write permission to .htaccess file using FTP or hosting control panel when activating permalinks and then change the permission back to 660 or 644 to avoid anyone modifying it mistakenly.

Editorial Staff at WebNots are team members who love to build websites and share the learning with webmasters community. Follow us on Facebook and Twitter.

Leave a Comment