How does permalink WordPress work?

I am a php developer and am currently developing a CMS / blog system. I want to add a permalink system such as WordPress. I am wondering how WordPress parses a permalink. For example, how to get data of type idand post namefrom:

example.com/id/123/post/example/

In short, I want the system receives idand post nameof URL-addresses. I want users to be able to modify permalink structure like WordPress using tags like:

id/%postid%/post/%postname%/

How to get data in variables of type $idand $post_name, where the values ​​will be 123and example? Please help me. Thanks in advance.

+5
source share
2 answers

apache mod_rewrite . , , .htaccess, , , PHP $_GET.

, - : ?reactor=13 /reactor/13/

.htaccess:

RewriteEngine on
RewriteRule reactor/([0-9]+)/$ index.php?id=$1

, index.php //13/, index.php $_GET:

Array
(
    [id] => 13
)

, HTML, URL- .

, .

WordPress , .htaccess , WP, WP / .

+5

, , Apache, mod_rewrite .. .htaccess.

. , Google - .

0

All Articles