How does WordPress create URLs that Apache knows about?

Actually there is no communication happening between Apache and WordPress. The “magic” is happening in Apache mod_rewrite rules. For a standard WordPress installation, you have the following rules in .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # … Read more

Get Permalink without domain (i.e. get relative permalink) [duplicate]

Use $_SERVER[‘REQUEST_URI’] instead of get_permalink() to grab the current URL. get_permalink will give you the full address of the current post, not the address of the URL visited. e.g. for example.com/test/page echo $_SERVER[‘REQUEST_URI’]; prints /test/page Note that this doesn’t include the hashtag, as that part never gets sent to the server, and it also doesn’t … Read more

Change media item permalink

Yes! Go to your Media Library Find the Image Click Edit Locate the Permalink under the Title Click Edit Change the Permalink Click Update! Edit If for some reason you cannot Edit the Images’ Permalink… you could: Delete Image Change your Pages’ Permalink Re-Upload Image

where is permalink info stored in database?

In the wp_options table there is a record where option_name = “permalink_structure”. However, the true, ultimate control of url rewriting is controlled by the WP_Rewrite API which saves/caches its information in the rewrite_rules wordpress option (also found in the wp_options table). EDIT: Also, when editing a page/post, you can change the “permalink” for that page/post … Read more

Need help with add_rewrite_rule

Some background on rewrite rules The WP Rewrite system looks complicated, but in fact it’s not that hard to understand how it works. It is used to parse pretty URLs (/designers/) as if they were non-pretty (/index.php?pagename=designers). The basic idea is that you have a list of rewrite rules, regular expressions that can match the … Read more