How to Create Rewrite Rule for wordpress website in windows hosting

Create Rewrite Rule

  1. Open the Web.config file (located in the same directory as the WordPress files). If you do not have a Web.config file in the WordPress directory, create it.
  2. Copy and paste the following XML section into the system.webServer element:

    <rewrite>
        <rules>
            <rule name="Main Rule" stopProcessing="true">
                <match url=".*" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
    </rewrite>
    

This rule matches any requested URL; if the URL does not correspond to a file or a folder on a file system, then the rule rewrites the URL to Index.php and determines which content to serve based on the REQUEST_URI server variable that contains the original URL before it was modified by the rule

 

htaccess

The .htaccess is a distributed configuration file, and is how Apache handles configuration changes on a per-directory basis.

WordPress uses this file to manipulate how Apache serves files from its root directory, and subdirectories thereof. Most notably, WP modifies this file to be able to handle pretty permalinks.

This page may be used to restore a corrupted .htaccess file (e.g. a misbehaving plugin).

# 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>
# END WordPress

Reference Link Source  : 

https://docs.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-applications-on-iis/install-wordpress-on-iis

https://codex.wordpress.org/htaccess

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Adding FTP Accounts

Adding FTP Accounts If you are working on your website together with someone else or host...

Create an Email Accounts

Adding Mail Accounts To create an e-mail address: If you are subscribed to several hosting...

creating-or-removing-scheduled-tasks-in-plesk

Creating or Removing Scheduled Tasks in Plesk  On Windows servers, you can set them up to...

Creating Databases

Creating Databases To create a new database on a hosting account: If you are subscribed to...

Importing Databases

Importing Databases To import an existing database: If you are subscribed to several hosting...