1. Startseite
  2. Wordpress
  3. Adding pretty-print URLs

Adding pretty-print URLs

Übersicht

Pretty-print URLs (permalinks) in WordPress transform meaningless URL patterns, e.g. index.php?page_id=123 into meaningful URLs, like /wordpress/adding-pretty-print-urls. Navigation is easier to view in the browser, plus it helps with SEO. Enabling pretty-print is a two-part process, add a few lines to your .htaccess and configure the display style in WordPress.

Permalinks before and after as seen in the browser.

Permalinks before and after as seen in the browser.

Lösung

  1. Erstellen einer .htaccess file inside the Dokumentenstamm for your WordPress site if it does not already exist.
  2. Add the following lines to the .htaccess file
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    • Dateien > Datei-Manager works well for performing a quick edit on this file
  3. Login to your WordPress admin portal, typically /wp-admin, e.g. http://example.com/wp-admin
  4. Visit Settings > Permalinks to choose a permalink structure under Common Settings
    • we use a custom structure with the value /%category/%postname%/ since multiple categories could contain the same post title

      Custom permalink used on kb.okra.host.

      Custom permalink used on kb.okra.host.

  5. Click Save Changes

 

See also

Aktualisiert am März 7, 2021

Verwandte Artikel