Permalink is the term used in WordPress to indicate an URL where the content is stored permanently. This is used to generate pretty clean URLs for blog post and pages in WordPress. Permalink is an optional feature but highly famous and recommended among WordPress community for SEO and user friendly reasons. Each page created in WordPress site is stored as a permanent URL which is identified with the running number. This is called ugly URL since it is not possible for both search engines and users to get any information regarding the content on the page.
In order to overcome this WordPress has a feature called permalinks to change the ugly URL to a pretty looking one. If enabled, URL of the page will be generated with descriptive words from the title of the page (or as per the permalinks settings). This helps to make the URL human readable and user friendly.
How to Find Permanent URL of WordPress Page?
When you create a post in WordPress, it is stored and accessible using a permanent URL “http://example.com/?p1”, where p1 indicates the post 1 created in a site “example.com”. You can find the post number on the browser address bar when creating or editing the post.
If permalinks structure is enabled to use a custom structure as post name then the post will be used in a pretty URL like “http://example.com/post-title/”. You can view the permalink under the post title as shown below in Classic Editor.
In Gutenberg editor, you can view the permalink in sidebar post panel.
How to Enable Permalinks for New Site?
Login to your WordPress admin dashboard and navigate to “Settings > Permalinks”. WordPress allows the following options for setting URL of your site.
Below table explains the options with examples:
Permalinks Option | Description | Example |
---|---|---|
Default | Default option will show the ugly link with post number. | http://example.com/?p=123 |
Day and name | Include the complete date in the post URL. | http://example.com/2016/10/26/post-title/ |
Month and name | Include month and year in the post URL. | http://example.com/2016/10/post-title/ |
Numeric | Similar to default but only include the post number. | http://example.com/archives/123 |
Post name | Add post title as URL. | http://example.com/post-title/ |
Custom Structure | Any custom structure to define the URL. For example, you can add the post name using /%postname%/. | http://example.com/post-title/ |
How Permalinks Work in WordPress?
When permalinks is enabled in a site, the ugly permanent URLs are forwarded to pretty URLs by means of redirect set in .htaccess file. WordPress creates the following entries in .htaccess file using “mod_rewrite” module of Apache server.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Thus in order to enable permalinks you should have permission to modify .htaccess file.
Note: Permalinks will stop working if .htaccess file entries are removed or corrupted, just disable and enable permalink settings from WordPress admin panel to create the required entries again. Learn more about permalinks issues and solutions in WordPress.
Why You Should Enable Permalinks?
The simple reason to enable permalinks is to offer user friendly URLs. This helps users to remember the page URL and directly access the page when required. Also the descriptive URLs help to link the content and the URL more closely.
On other hand pretty URLs will improve the SEO of the pages. For example, the page with the URL “http://example.com/?123” showing on search results will attract fewer clicks than the page with the URL “http://example.com/post-title”. Also you can add the keywords of the page in URL to improve the on-page SEO.
Changing Permalink Structure of Existing Site
Permalinks are to be enabled when the site is launched newly. There are many reasons one may look for changing the permalink structure of a site.
- You may be using the default ugly links and want to change to “post name” to improve SEO.
- You may be using date structure but the content is not bounded to the date. Hence you want to change the structure to the one not limited to the time.
The general and recommended structure is to use “Post name” option. This will just suffix the post title to the site name to create a page URL.
If you are looking for changing the URL structure of a live WordPress then ensure to setup 301 redirects from old URL to new URL. You can do this using Redirection plugin or adding directives in .htaccess file.
Yoast Redirect Generation Tool
If you want to convert your permalinks structure to “post name” then Yoast has a tool for this. It is called permalinks helper which generates .htaccess directive when changing permalinks structure of the URLs. You can provide the old URL and choose the existing permalinks structure to get the redirect for new permalinks with “/%postname%/” structure.
Steps Involved in Changing Permalinks Structure
Below are the steps involved in changing permalinks structure of an existing WordPress site:
- Download all existing URLs from your XML Sitemap for reference.
- Change the new permalinks structure from WordPress admin dashboard under “Settings > Permalinks” section.
- Setup 301 redirects using plugin or using .htaccess directive.
- Test old URLs are properly redirecting to new URLs from your reference list.
- Generate new XML Sitemap with new URL structure.
- Resubmit your XML Sitemap to Google and other search engines.
It may take some time for search engines to replace the old URLs with new URLs in search results.
Changing Permalinks for Single Page in WordPress
It is common to update the page/post content and URL so that users can get the latest details. In general, you can always change the title without changing its permalink. However, if you really wanted to change the permalink of a single page or post, you can easily do that when editing the content.
- Edit the post or page that you want to change in Gutenberg editor.
- Go to “Post” section on the right sidebar.
- Click the URL under “Summary” section.
- Edit permalink to change to new URL.
- Click “Update” button on the top bar to apply the changes.
Make sure to setup 301 redirect from your old permalink to new URL so that you will not lose the search engine ranking.
Leave a Reply
Your email is safe with us.