How is WordPress.htaccess and SEO generated?

I thought about using WordPress, or maybe just copied a few features to the internal site, but before using it, I would like to know how it works.

I think WP is a bunch of slam code, so I hope some of you can help me on how it's built.

How is .htaccess and url rewrite rewritten along with index.php? -.htaccess sends everything to index.php and I tried to follow each file but I don't see how index.php detects url. How could I create a simple version of this?

Greetings,

+1


a source to share


3 answers


The WordPress code has a very detailed summary of Using Permalinks .



If you are wondering how it was implemented see the WordPress Rewrite API in the file /wordpress/wp-includes/rewrite.php

and check

+6


a source


index.php is actually called with parameters:


index.php?page=55

      

I assume you are looking for a way to have good links for seo without? Parameters

the htaccess part might look like:




RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)/$ index.php?page=$1 [NC,L,QSA]

      

  • we have not redirected 2. + 3. the link does not point to a real file or directory
  • display stuff after slash as page parameter

so for example "www.homepage.com/superpage" is displayed on the page "www.homepage.com/index.php?page=superpage"

+1


a source


Correction ... according to the default .htaccess rules in WordPress and below, it will first look if there is a file or directory that exists in the path given in the url. If there is no file / directory in this location, index.php is called.

This will ensure that the admin section works the way it does. It also ensures that you can dump any file in the WordPress directory and still have access to them.

Once the redirect reaches index.php, the WordPress redirect API is called as this post .

0


a source







All Articles