Pretty URLs

Use a pretty URL structure with htaccess rewrite.

The URLs of the permalinks are normally build up with the URL parameter post=title-of-the-post, like In order to be able to have permalinks without the URL parameter, like, you have to perform 2 steps:

  • Enter a redirect directive inside your main (root) htaccess file
  • Enable the checkbox Pretty URLs / Htaccess rewrite

After enabling the htaccess rewrite, the old permalink URLs with the URL parameter will still work.

Use the following htaccess code in your main htaccess file. Replace blogpage with your actual blog page name or folder structure.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule blogpage/author/(.*) /blogpage/index.php?author=$1 [L,NC,QSA]
RewriteRule blogpage/category/(.*) /blogpage/index.php?category=$1 [L,NC,QSA]
RewriteRule blogpage/date/(.*) /blogpage/index.php?date=$1 [L,NC,QSA]
RewriteRule blogpage/search/(.*) /blogpage/index.php?search=$1 [L,NC,QSA]
RewriteRule blogpage/tag/(.*) /blogpage/index.php?tag=$1 [L,NC,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule blogpage/(.*) /blogpage/index.php?post=$1 [L,NC,QSA]

Pretty URLs

< Previous Post
Next Post >