How Do You Add a Rewrite Rule in WordPress?

Adding a rewrite rule in WordPress is easy. First, go to your WordPress admin area and click on the “Settings” link in the left-hand menu.

Then, on the Settings page, click on the “General” tab. In the “WordPress rewrite rules” section, click on the “add new” button.

In the “WordPress rewrite rule” dialog box, type the following text into the “name” field and then click on the “create” button:

rewrite ^index\.php$ – [L]

In the “url” field, type the following text:

/index.php

In the “condition” field, type the following text:

!404

In the “action” field, type the following text:

rewrite ^(.*)$ – [L]

!^wp-admin/admin-ajax.php$

rewrite ^wp-admin/admin.php$ – [L]

!^(.*)$.