Title: got_mod_rewrite
Published: April 25, 2014
Last modified: May 20, 2026

---

# got_mod_rewrite(): bool

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#wp--skip-link--target)

Returns whether the server is running Apache with the mod_rewrite module loaded.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#return)󠁿

 bool Whether the server is running Apache with the mod_rewrite module loaded.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#source)󠁿

    ```php
    function got_mod_rewrite() {
    	$got_rewrite = apache_mod_loaded( 'mod_rewrite', true );

    	/**
    	 * Filters whether Apache and mod_rewrite are present.
    	 *
    	 * This filter was previously used to force URL rewriting for other servers,
    	 * like nginx. Use the 'got_url_rewrite' filter in got_url_rewrite() instead.
    	 *
    	 * @since 2.5.0
    	 *
    	 * @see got_url_rewrite()
    	 *
    	 * @param bool $got_rewrite Whether Apache and mod_rewrite are present.
    	 */
    	return apply_filters( 'got_rewrite', $got_rewrite );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-admin/includes/misc.php#L16)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/misc.php#L16-L32)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#hooks)󠁿

 [apply_filters( ‘got_rewrite’, bool $got_rewrite )](https://developer.wordpress.org/reference/hooks/got_rewrite/)

Filters whether Apache and mod_rewrite are present.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#related)󠁿

| Uses | Description | 
| [apache_mod_loaded()](https://developer.wordpress.org/reference/functions/apache_mod_loaded/)`wp-includes/functions.php` |

Determines whether the specified module exist in the Apache config.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [WP_Site_Health::get_test_authorization_header()](https://developer.wordpress.org/reference/classes/wp_site_health/get_test_authorization_header/)`wp-admin/includes/class-wp-site-health.php` |

Tests if the Authorization header has the expected values.

  | 
| [network_step1()](https://developer.wordpress.org/reference/functions/network_step1/)`wp-admin/includes/network.php` |

Prints step 1 for Network installation process.

  | 
| [save_mod_rewrite_rules()](https://developer.wordpress.org/reference/functions/save_mod_rewrite_rules/)`wp-admin/includes/misc.php` |

Updates the htaccess file with the current rules if it is writable.

  | 
| [got_url_rewrite()](https://developer.wordpress.org/reference/functions/got_url_rewrite/)`wp-admin/includes/misc.php` |

Returns whether the server supports URL rewriting.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/got_mod_rewrite/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fgot_mod_rewrite%2F)
before being able to contribute a note or feedback.