Pretty permalinks (url rewriting) info and links Print PDF
1-pretty_permalinks-info_and_links.html — rev 17 October 2014 ➽ back to dir
Some words to know ...
url rewriting - the technical term for it.
pretty permalinks - what WordPress calls it.
Also known as:
Rewritten URLs, short URLs, fancy URLs, SEF (search engine friendly).
mod_rewrite - the module (additional code) for apache that makes it work.
What is url rewriting?
All web programming (not just wordpress) works with query strings or pathinfo.
This is useful and efficient - but not pretty to look at in the browser
address bar. Also not so useful for people to figure out.
So there is a way to translate "pretty" urls in the address bar,
to the useful query strings that the program needs.
In WordPress, we can redirect all URLs to WordPress index.php -- then
WordPress breaks the URL into parts and uses regular expressions to
translate into the query string that tells WordPress what to display.
How to make them work?
- Apache config: The "mod_rewrite_module must be enabled in apache web server
(You shouldn't have to worry about this -- on any good web host,
this is enabled. For your local install, you may have to
enable it, depending on how your apache is installed.)
- WordPress admin: Enable permalinks from WordPress Settings/Permalinks panel.
- If it is set to Default, permalinks are disabled.
With any other value, they are active.
- .htaccess file: Rewrite codes are saved by WordPress in a file called
.htaccess in the document root of your site.
If file permissions prevent WordPress from writing this file,
you can make the file yourself, copy the codes from the Wordpress
permalinks page, and paste them in.
A good start ...
How does WordPress URL rewriting work?
[Millian, Dev4Press.com - March 2012]
The basics of how it works.
Using Permalinks (URL rewriting) for WordPress
The word, for WordPress, at the Codex.
Solving permalinks problems in WordPress - Forum
Learning more about how it works ...
Very excellent explanation of URL rewriting Smasing Mag - November 2011]
What it is; how it helps; rewriting syntax and regular expressions;
examples; how it works in wordpress; more.
Another excellent explanation: 
Good step-by-step explanation with examples; useful links.
Good questions and problems in comments.
References and Cheatsheets:
The Apache reference documentation:
mod_rewrite Cheatsheet, as HTML and PDF:
Going deeper ...
URL Rewriting Guide - at Apache.org
Practical uses, with explanations and solutions.
"Rewrite engine", at Wikipedia