How does URL rewriting work?
-
[Moderator note: Moved to Everything else WordPress.]
Hi guys
As an academic exercise, I’m trying to figure out how WordPress rewrites URLs.
Not as related to .htaccess and httpd.conf as such – but how WP knows that this
http://www.domain.com/?page_id=2282
is exactly equal to this
http://www.domain.com/2017/02/17/sample-post/
while referencing the same content that then appears in the browser window.
I’ve searched the database for some kind of translation table, but cannot find anything applicable.
Which table contains these translations?
Which PHP code files control the URL rewriting process?
E. g. logically I cannot see how mod_rewrite rules in a .htaccess can “know” that
page_id=2282 = 2017/02/17/sample-post/
without there being processing in PHP and the MySQL database getting involved somehow at some point. “2017/02/17/sample-post/” is meaningless by itself and something must “know” somewhere in the Apache / WP PHP code / MySQL structure that the one equals the other.
Surely WP must store somewhere what relates to what – but I cannot find such a mechanism anywhere I’ve looked.
Anybody got any pointers?
Thanks!
Stefan
The topic ‘How does URL rewriting work?’ is closed to new replies.