The .htaccess file for a wordpress site looks something like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
...and there is no rewrite map set in htdocs. How does this work? How does Apache know how to rewrite these url?
The Apache does not know. All the requests are sent to index.php
and Wordpress keeps an internal log of which page to redirect where, and it redirects it. So, in essence, Wordpress actually has two sets of rewrite rules, one internally and a "greedy" external rule in your .htaccess which basically makes all requests refer to the internal rewrite rules.
You may be interested in using this plugin which shows all the internal rewrites that Wordpress is doing itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With