{"id":97685,"date":"2019-12-16T14:26:07","date_gmt":"2019-12-16T20:26:07","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=support&#038;p=97685"},"modified":"2025-07-28T11:07:00","modified_gmt":"2025-07-28T17:07:00","slug":"htaccess-deprecation","status":"publish","type":"support","link":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/","title":{"rendered":".htaccess Deprecation and Alternatives"},"content":{"rendered":"<p>WP Engine does not support the .htaccess file and has deprecated it in order to increase website performance and to match industry trends. If your site used custom .htaccess directives outside of the default WordPress\u00ae rules (such as redirects, headers, or access rules) they can be converted using the guidance provided in this article.<sup><a href=\"#legal-disclaimer\">1<\/a><\/sup><\/p>\n\n\n\n<p>This article includes overviews of alternatives for common .htaccess directives, including explanations of what each directive does, links to more information on the web, and examples of how to implement each rule type by alternative.<\/p>\n\n\n\n\n\n<a name=\"what\"><\/a><a name=\"#What_is_the_htaccess_file_and_why_is_it_being_deprecated\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h2 class=\"wp-block-heading\">What is the .htaccess file and why was it deprecated?<\/h2>\n\n\n\n<p>PHP servers are used to execute the code that WordPress runs on. The <a href=\"https:\/\/wpengine.com\/support\/htaccess\/\">.htaccess<\/a> is a PHP configuration file that a web admin can use to tell the server how to interact with a website. It can control any number of things on a site-by-site basis, like how your URLs are formed or restricting access to a directory.<\/p>\n\n\n\n<p>The .htaccess file has performance implications on sites leveraging an Apache backend server. As .htaccess files are read recursively, this can lead to file system reads on every page load on your site. On smaller sites this doesn\u2019t lead to a big impact, but as the number of directories on a site gets larger, there is an impact those file system crawls have on performance. You can read more about the recommendations around this in \u201c<a href=\"https:\/\/httpd.Apache.org\/docs\/2.4\/howto\/htaccess.html#when\" target=\"_blank\" rel=\"noopener noreferrer\">When (not) to use .htaccess files<\/a>\u201d from Apache.org.<\/p>\n\n\n\n<p>Most importantly, .htaccess files tie our architecture to Apache as a backend web server. As new exciting technologies arise, and open up new features and performance we\u2019d like to make available to our customers, it becomes paramount to break that dependency as we evolve as a Digital Experience Platform. We\u2019re incredibly excited at the evolution, and the velocity we\u2019ll be able to deliver as part of this change in the future.<\/p>\n\n\n\n<p>We recognize the overhead this will have on our customers as they prepare for upgrades. We believe it\u2019s in the best interest of our customers to deprecate and remove .htaccess support going forward. We\u2019ve been committed to smoothing out the transition period, and have made platform changes as we\u2019ve encountered challenges. If you\u2019re in a situation where you don\u2019t know the best course of action, or believe that the .htaccess is the only manner in which to accomplish your goals, please do not hesitate to reach out to our Support team. They\u2019ll be able to help ease this transition, and raise issues to our development teams to address the shortcomings this deprecation creates.<\/p>\n\n\n\n<p>While our data suggests only a small amount of customers leverage the .htaccess feature, we recognize that there are those that have relied on this functionality. We\u2019re committed to continually smoothing this transition, and will be more than happy to assist with recommendations and alternatives. We suggest reviewing our list of alternatives below and testing any changes on a <a href=\"https:\/\/wpengine.com\/support\/environments\/\">Staging or Development environment<\/a> first.<\/p>\n\n\n\n<p>While our Support team does not support PHP or code development, if you have any questions or concerns about this change, please reach out to our <a href=\"https:\/\/my.wpengine.com\/support\/\">Support team<\/a> at any time.<\/p>\n\n\n\n<a name=\"wordpress\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h2 class=\"wp-block-heading\">Default WordPress .htaccess Directives<\/h2>\n\n\n\n<p>By our analysis, most WP Engine websites will <em>not<\/em> need to make any changes as they are using a default WordPress version of the .htaccess. Default WordPress rewrites will be handled by WP Engine automatically at the server level.<\/p>\n\n\n\n<p>If your .htaccess file contains only default content, no changes need to be made. <a href=\"https:\/\/wordpress.org\/support\/article\/htaccess\/\" target=\"_blank\" rel=\"noreferrer noopener\">You can find the default .htaccess files used for WordPress here<\/a>.<\/p>\n\n\n\n<p>If your .htaccess file contains content beyond the default WordPress state, <a href=\"https:\/\/wpengine.com\/support\/htaccess-deprecation\/#Directive_Alternatives_Overview\">see the alternatives below<\/a>.<\/p>\n\n\n\n<a name=\"list\"><\/a><a name=\"Directives_and_Alternatives\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h2 class=\"wp-block-heading\">Directive Alternatives Overview<\/h2>\n\n\n\n<p>If your site is using .htaccess directives outside of the default WordPress rules (above), we have put together a list of recommended alternatives.<\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter is-style-stripes\"><table><thead><tr><th width=\"20%\">Directive<\/th><th width=\"20%\">Purpose<\/th><th width=\"60%\">Alternative<\/th><\/tr><\/thead><tbody><tr><td><b>Deny from all<\/b><\/td><td>Restrict access<\/td><td>\n<ul>\n<li>By default, PHP files have guards at a platform level that prevent them from being served. Other static files are served by Nginx and not Apache.<\/li>\n<li>Nginx rules can be added to replicate this behavior if needed by <a href=\"https:\/\/my.wpengine.com\/support\">contacting Support<\/a>.<\/li>\n<\/ul>\n<\/td><\/tr><tr><td><b>Allow from all<\/b><\/td><td>Allow access<\/td><td>\n<ul>\n<li>PHP files have guards at a platform level that prevent them from being served. Other static files are served by Nginx and not Apache.<\/li>\n<li>Nginx rules can be added to replicate this behavior if needed by <a href=\"https:\/\/my.wpengine.com\/support\">contacting Support<\/a>.<\/li>\n<\/ul>\n<\/td><\/tr><tr><td><b>Rewrites<\/b><\/td><td>Forces redirects and rewrites<\/td><td>\n<ul>\n<li><a href=\"https:\/\/wpengine.com\/support\/redirect\/\">Add 301 and 302 redirects to the User Portal<\/a>. User Portal redirects are better for performance and scaleability.<\/li>\n<li><a href=\"https:\/\/my.wpengine.com\/support\">Contact Support<\/a> with custom Nginx rewrites, if needed.<\/li>\n<li>Use a plugin.<\/li>\n<li><a href=\"#redirects\">Read more about migrating redirects.<\/a><\/li>\n<\/ul>\n<\/td><\/tr><tr><td><b>SetHandler<\/b><\/td><td>Specifies how to handle certain file types<\/td><td>\n<ul>\n<li>None<\/li>\n<li>Static assets are served by Nginx and not Apache (where the .htaccess would be processed).<\/li>\n<\/ul>\n<\/td><\/tr><tr><td><b>Option-indexIgnore<\/b>*<\/td><td>Prevent directory browsing<\/td><td>\n<ul>\n<li>None<\/li>\n<li>WP Engine already disallows indexing of directories by default.<\/li>\n<\/ul>\n<\/td><\/tr><tr><td><b>mod_<\/b> <strong>Headers<\/strong><\/td><td>Header tweaking<\/td><td>\n<ul>\n<li>Headers should be sent with PHP code.<\/li>\n<\/ul>\n<\/td><\/tr><tr><td><b>AddType<\/b><\/td><td>Adds MIME type support for app type<\/td><td>\n<ul>\n<li>Static assets are served by Nginx and not Apache (where the .htaccess would be processed).<\/li>\n<li>If additional rules are desired, they can be added to the Nginx config by contacting <a href=\"https:\/\/my.wpengine.com\/support\">Support<\/a>.<\/li>\n<\/ul>\n<\/td><\/tr><tr><td><strong>Caching<\/strong><\/td><td>Sets cache expirations<\/td><td>\n<ul>\n<li>WP Engine manages caching rules at a server level for you, by default.<\/li>\n<li>Additional caching rules can be managed in PHP code.<\/li>\n<li>Extra caching rules for static assets can be applied to Nginx by contacting <a href=\"https:\/\/my.wpengine.com\/support\">Support<\/a>.<\/li>\n<\/ul>\n<\/td><\/tr><tr><td><strong>Security<\/strong><\/td><td>Disable PHP processing in plugin(s).<\/td><td>\n<ul>\n<li>WordPress plugins often add security rules to the .htaccess. WP Engine already applies these rules by default at a server level.<\/li>\n<li>Plugins should handle additional directives in their PHP code.<\/li>\n<\/ul>\n<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h3 class=\"wp-block-heading\">Access Rules<\/h3>\n\n\n\n<p>Managing access rules can be done from your User Portal as an alternative to placing these rules in the .htaccess. All websites on WP Engine automatically have this Web Rules page enabled. <a href=\"https:\/\/wpengine.com\/support\/web-rules\/\">Learn more about managing web rules here.<\/a><\/p>\n\n\n\n<p>Below are examples of how to translate the following .htaccess directives into <a href=\"https:\/\/wpengine.com\/support\/web-rules\/#Access_Rules\">Access Rules<\/a>.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>rewrite_deny<\/strong>\n<ul class=\"wp-block-list\">\n<li>Rewrite with status code 403 by creating a DENY <a href=\"https:\/\/wpengine.com\/support\/web-rules\/#Access_Rules\">access web rule<\/a>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>satisfy<\/strong>\n<ul class=\"wp-block-list\">\n<li>This directive is only used when a particular area of your site is restricted by a combination of client IP address and user\/password authentication.<\/li>\n\n\n\n<li>Password protection for WordPress paths can be done via plugins instead.<\/li>\n\n\n\n<li>Protection for all paths (served by NGINX) is not yet supported.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<a name=\"redirects\"><\/a><a name=\"Handling_301_and_302_Redirects\"><\/a><a name=\"Redirects_and_Rewrites\"><\/a>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h3 class=\"wp-block-heading\">Redirects and Rewrites<\/h3>\n\n\n\n<p>If your site had redirect rules in the .htaccess, they should be relocated in order to remain both functional and optimized. It is always recommended to consolidate as many rules as possible using <a href=\"https:\/\/wpengine.com\/support\/regex\/\">RegEx<\/a> regardless of the number of redirects needed or how they are applied.<\/p>\n\n\n\n<p><strong>Fewer Than 1000 Redirects<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Redirects can be added to WP Engine\u2019s Nginx configuration\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/wpengine.com\/support\/redirect\/\">Add redirects through the User Portal<\/a><\/li>\n\n\n\n<li>Bulk import redirects by contacting <a href=\"https:\/\/my.wpengine.com\/support\">WP Engine Support<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Add redirects rules to the <a href=\"https:\/\/wordpress.org\/plugins\/redirection\/\" target=\"_blank\" rel=\"noopener noreferrer\">Redirection plugin<\/a><\/li>\n\n\n\n<li>Manage redirects in <a href=\"https:\/\/yoast.com\/wordpress\/plugins\/seo\/redirects-manager\/\" target=\"_blank\" rel=\"noopener noreferrer\">Yoast SEO Premium<\/a>\u2018s redirect manager<\/li>\n<\/ul>\n\n\n\n<p><strong>More Than 1000 Redirects<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Importing redirects into the WP Engine Nginx configuration will not be efficient at this quantity, due to bloating and overhead.<\/li>\n\n\n\n<li>We suggest loading redirects into the <a href=\"https:\/\/wordpress.org\/plugins\/redirection\/\" target=\"_blank\" rel=\"noopener noreferrer\">Redirection plugin<\/a> or, if you\u2019re using Yoast SEO, manage redirects in <a href=\"https:\/\/yoast.com\/wordpress\/plugins\/seo\/redirects-manager\/\" target=\"_blank\" rel=\"noopener noreferrer\">Yoast Premium<\/a><\/li>\n<\/ul>\n\n\n\n<p><strong>Bulk Migrate Redirects from the .htaccess<\/strong><\/p>\n\n\n\n<p>All of the recommended redirect alternatives allow the bulk import of Apache (.htaccess-formatted) redirects. This means importing existing redirects from the .htaccess can be done quickly and easily, and does not require redirects be moved one at a time. Simply copy the rules from your .htaccess file, then import using the guide:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/wpengine.com\/support\/redirect\/#bulk-import\">Bulk import redirects to the WP Engine Nginx configuration<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/redirection.me\/support\/import-export-redirects\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bulk import redirects to Redirection plugin<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/yoast.com\/help\/import-redirects\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bulk import redirects to Yoast Premium redirect manager<\/a><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Rewrite Rules<\/h4>\n\n\n\n<p>Redirects and rewrites can be added to your WP Engine configuration using either Redirect Rules or Rewrite Rules. Below are examples of alternatives when using the Web Rules Rewrite Rules.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>redirect<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_alias.html#redirectmatch\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_alias.html#redirectmatch<\/a><\/li>\n\n\n\n<li>Can be added as a <a href=\"https:\/\/wpengine.com\/support\/redirect\/\">Redirect Rule<\/a> or a <a href=\"https:\/\/wpengine.com\/support\/web-rules\/#Rewrite_Rules\">Rewrite Rule<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>rewritebase_not_root<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/current\/mod\/mod_rewrite.html#rewritebase\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/current\/mod\/mod_rewrite.html#rewritebase<\/a><\/li>\n\n\n\n<li>The <a href=\"https:\/\/wpengine.com\/support\/web-rules\/#Rewrite_Rules\">Web Rules Engine<\/a> does not have the concept of a document root, so you\u2019ll need to add the new \u201cbase\u201d in the destination RegEx URL. For example:\n<ul class=\"wp-block-list\">\n<li>Action: internal<\/li>\n\n\n\n<li>Source: ^\/index\\.html<\/li>\n\n\n\n<li>Destination: \/myapp\/welcome.html<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>rewrite_arbitrary_status<\/strong>\n<ul class=\"wp-block-list\">\n<li>Not Supported.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>rewrite_cond_existing<\/strong><ul><li><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_rewrite.html#rewritecond\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_rewrite.html#rewritecond<\/a> In the .htaccess this may appear as:<ul><li>&nbsp;&nbsp;&nbsp;&nbsp;RewriteEngine On<\/li><li>&nbsp;&nbsp;&nbsp;&nbsp;RewriteCond %{HTTP_USER_AGENT} \u201c=ROBOT-UA\u201d [OR]<\/li><li>&nbsp;&nbsp;&nbsp;&nbsp;RewriteCond %{HTTP_USER_AGENT} \u201c=EVIL-ROBOT-UA\u201d<\/li><li>&nbsp;&nbsp;&nbsp;&nbsp;RewriteRule \u201c^\/index\\.html$\u201d&nbsp; \u201cbot.html\u201d<\/li><\/ul><\/li><li>Note the presence of the <code>[OR]<\/code>. Web Rule Conditionals are AND\u2019ed together, so in order to replicate this you will need to duplicate the rule 2 times, each with the respective condition. Converted to a <a href=\"https:\/\/wpengine.com\/support\/web-rules\/#Rewrite_Rules\">Rewrite Rule<\/a> this may look like the following example:<\/li><\/ul>\n<ul class=\"wp-block-list\">\n<li>Rule 1:\n<ul class=\"wp-block-list\">\n<li>Action: internal<\/li>\n\n\n\n<li>Source: ^\/index.html<\/li>\n\n\n\n<li>Destination: bot.html<\/li>\n\n\n\n<li>Conditions:\n<ul class=\"wp-block-list\">\n<li>Type: Header<\/li>\n\n\n\n<li>Operator: Equals (=)<\/li>\n\n\n\n<li>Name: User-Agent<\/li>\n\n\n\n<li>Value: ROBOT-UA<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Rule 2:\n<ul class=\"wp-block-list\">\n<li>Action: internal<\/li>\n\n\n\n<li>Source: ^\/index.html<\/li>\n\n\n\n<li>Destination: bot.html<\/li>\n\n\n\n<li>Conditions:\n<ul class=\"wp-block-list\">\n<li>Type: Header<\/li>\n\n\n\n<li>Operator: Equals (=)<\/li>\n\n\n\n<li>Name: User-Agent<\/li>\n\n\n\n<li>Value: EVIL-ROBOT-UA<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>rewrite_cond_notexisting<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_rewrite.html#rewritecond\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_rewrite.html#rewritecond<\/a><\/li>\n\n\n\n<li>ENV, REMOTE_ADDR, HTTPS, REQUEST_SCHEME, etc.<\/li>\n\n\n\n<li>Not supported.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>rewrite_missing<\/strong>\n<ul class=\"wp-block-list\">\n<li>Not Supported.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>rewrite_not_index<\/strong>\n<ul class=\"wp-block-list\">\n<li>Converted to a Rewrite Rule this may look like the following example:\n<ul class=\"wp-block-list\">\n<li>Action: internal<\/li>\n\n\n\n<li>Source: ^\/index.php<\/li>\n\n\n\n<li>Destination: \/blah.php<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>rewrite_redirect<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_rewrite.html#rewriterule\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_rewrite.html#rewriterule<\/a><\/li>\n\n\n\n<li>This rule the RewriteRule directive to perform a 3xx redirect. In the .htaccess it may appear as:\n<ul class=\"wp-block-list\">\n<li>RewriteRule (.*) https:\/\/www.example.com\/$1 [R=301,L]<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>The presence of the <code>L<\/code> flag in this case means this should be the <em>first<\/em> rewrite rule if there are <em>multiple<\/em> rewrite rules. As a <a href=\"https:\/\/wpengine.com\/support\/web-rules\/#Rewrite_Rules\">Rewrite Rule<\/a> this may appear as:\n<ul class=\"wp-block-list\">\n<li>Action: permanent<\/li>\n\n\n\n<li>Source: (.*)<\/li>\n\n\n\n<li>Destination: https:\/\/www.example.com\/$1<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h3 class=\"wp-block-heading\">WordPress Features<\/h3>\n\n\n\n<p>Below are examples of how to translate the following .htaccess directives using WordPress features.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>browsermatch<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/current\/mod\/mod_setenvif.html#browsermatch\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/current\/mod\/mod_setenvif.html#browsermatch<\/a><\/li>\n\n\n\n<li>Implement a check in PHP around the User-Agent Header <em>($_SERVER[\u2018HTTP_USER_AGENT\u2019])<\/em> and set an <em>env<\/em> if it matches.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>env<\/strong>\n<ul class=\"wp-block-list\">\n<li>Can access through <a href=\"https:\/\/www.php.net\/manual\/en\/reserved.variables.environment.php\" target=\"_blank\" rel=\"noreferrer noopener\">$_ENV<\/a>&nbsp;<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>php_flag<\/strong> \/ <strong>php_value<\/strong>\n<ul class=\"wp-block-list\">\n<li>Certain php config values can be changed at runtime using the <a href=\"https:\/\/www.php.net\/manual\/en\/function.ini-set.php\">ini_set()<\/a> function. Reference: <a href=\"https:\/\/www.php.net\/manual\/en\/configuration.changes.modes.php\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.php.net\/manual\/en\/configuration.changes.modes.php<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>requestheader<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/current\/mod\/mod_headers.html#requestheader\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/current\/mod\/mod_headers.html#requestheader<\/a><\/li>\n\n\n\n<li>Instead, use the WordPress <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/send_headers\/\" target=\"_blank\" rel=\"noreferrer noopener\">send_headers<\/a> hook.<\/li>\n\n\n\n<li>Get and modify request headers with <em>PHP ($_SERVER[\u2018HTTP_MY_HEADER\u2019])<\/em><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>setenv<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_env.html#setenv\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_env.html#setenv<\/a><\/li>\n\n\n\n<li>Can be done in wp-config.php using <a href=\"https:\/\/www.php.net\/manual\/en\/function.define.php\" target=\"_blank\" rel=\"noreferrer noopener\">define<\/a> or through <a href=\"https:\/\/www.php.net\/manual\/en\/reserved.variables.environment.php\" target=\"_blank\" rel=\"noreferrer noopener\">$_ENV<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<h3 class=\"wp-block-heading\">WP Engine Platform Features<\/h3>\n\n\n\n<p>Below are examples of how to translate the following .htaccess directives into existing WP Engine Platform features.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>errordocument<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/core.html#errordocument\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/2.4\/mod\/core.html#errordocument<\/a><\/li>\n\n\n\n<li>Not supported.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>require<\/strong>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_authz_core.html#require\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_authz_core.html#require<\/a><\/li>\n\n\n\n<li>This is used for access control, typically for <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Authentication#basic_authentication_scheme\" target=\"_blank\" rel=\"noreferrer noopener\">basic authentication<\/a>, when combined with .htaccess directives like:\n<ul class=\"wp-block-list\">\n<li>AuthType Basic<\/li>\n\n\n\n<li>AuthName \u201cRestricted Area\u201d<\/li>\n\n\n\n<li><a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_authn_file.html#authuserfile\" target=\"_blank\" rel=\"noreferrer noopener\">AuthUserFile<\/a>&nbsp; \/path\/to\/.htpasswd<\/li>\n\n\n\n<li>Require valid-user<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>The <a href=\"https:\/\/wpengine.com\/support\/password-protecting-wp-engine-site\/\" target=\"_blank\" rel=\"noreferrer noopener\">Password Protection Feature<\/a> can be used when controlling access to the entire site.<\/li>\n\n\n\n<li>The below .htaccess rule is similar to a <em>Deny All<\/em> rule, which could be created in the <a href=\"https:\/\/wpengine.com\/support\/web-rules\/\">Web Rules Engine<\/a> instead.\n<ul class=\"wp-block-list\">\n<li>Require all denied<\/li>\n\n\n\n<li>Typically used in conjunction with:\n<ul class=\"wp-block-list\">\n<li>&lt;IfModule mod_authz_core.c&gt;<\/li>\n\n\n\n<li>Require all denied<\/li>\n\n\n\n<li>&lt;\/IfModule&gt;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>In an .htaccess file in a directory like <em>\/wp-content\/uploads\/dlm_uploads\/.htaccess<\/em> to deny all access to that directory.<\/li>\n\n\n\n<li>Password protecting specific directories or URLs is not supported.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\">\n\n\n\n<p><strong>NEXT STEP: <a href=\"https:\/\/wpengine.com\/support\/php-guide\/\">Learn how to test and upgrade to a new PHP version<\/a><\/strong><\/p>","protected":false},"excerpt":{"rendered":"<p>With the upgrade to PHP 7.4, WP Engine has decided to deprecate the .htaccess file. See which alternatives we recommend to replace old htaccess directives.<\/p>\n","protected":false},"featured_media":126216,"template":"","meta":{"_acf_changed":false,"mediapress_authors_byline":[],"mediapress_draft_name":"","_mediapress_is_draft_copy":false},"support-categories":[23,3,59,6],"support-tag":[],"mediapress_author":[],"class_list":["post-97685","support","type-support","status-publish","has-post-thumbnail","hentry","support-categories-best-practices","support-categories-development","support-categories-speed-series","support-categories-platform"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>.htaccess Deprecation and Alternatives - Support Center<\/title>\n<meta name=\"description\" content=\"With the upgrade to PHP 7.4, WP Engine has decided to deprecate the htaccess file. See which alternatives we recommend to replace old htaccess directives.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wpengine.com\/support\/htaccess-deprecation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\".htaccess Deprecation and Alternatives - Support Center\" \/>\n<meta property=\"og:description\" content=\"With the upgrade to PHP 7.4, WP Engine has decided to deprecate the htaccess file. See which alternatives we recommend to replace old htaccess directives.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/support\/htaccess-deprecation\/\" \/>\n<meta property=\"og:site_name\" content=\"Support Center\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-28T17:07:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/htaccess-deprecation\\\/\",\"url\":\"https:\\\/\\\/wpengine.com\\\/support\\\/htaccess-deprecation\\\/\",\"name\":\".htaccess Deprecation and Alternatives - Support Center\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/htaccess-deprecation\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/htaccess-deprecation\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wpengine.com\\\/support\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"datePublished\":\"2019-12-16T20:26:07+00:00\",\"dateModified\":\"2025-07-28T17:07:00+00:00\",\"description\":\"With the upgrade to PHP 7.4, WP Engine has decided to deprecate the htaccess file. See which alternatives we recommend to replace old htaccess directives.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/htaccess-deprecation\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wpengine.com\\\/support\\\/htaccess-deprecation\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/htaccess-deprecation\\\/#primaryimage\",\"url\":\"https:\\\/\\\/wpengine.com\\\/support\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"contentUrl\":\"https:\\\/\\\/wpengine.com\\\/support\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/wp-engine-featured-image.png\",\"width\":1200,\"height\":630,\"caption\":\"WP Engine\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/htaccess-deprecation\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wpengine.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Support Posts\",\"item\":\"https:\\\/\\\/wpengine.com\\\/support\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\".htaccess Deprecation and Alternatives\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wpengine.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/wpengine.com\\\/support\\\/\",\"name\":\"Support Center\",\"description\":\"WP Engine&#039;s Support Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wpengine.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":".htaccess Deprecation and Alternatives - Support Center","description":"With the upgrade to PHP 7.4, WP Engine has decided to deprecate the htaccess file. See which alternatives we recommend to replace old htaccess directives.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/","og_locale":"en_US","og_type":"article","og_title":".htaccess Deprecation and Alternatives - Support Center","og_description":"With the upgrade to PHP 7.4, WP Engine has decided to deprecate the htaccess file. See which alternatives we recommend to replace old htaccess directives.","og_url":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/","og_site_name":"Support Center","article_modified_time":"2025-07-28T17:07:00+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/","url":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/","name":".htaccess Deprecation and Alternatives - Support Center","isPartOf":{"@id":"https:\/\/wpengine.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/#primaryimage"},"image":{"@id":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/#primaryimage"},"thumbnailUrl":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","datePublished":"2019-12-16T20:26:07+00:00","dateModified":"2025-07-28T17:07:00+00:00","description":"With the upgrade to PHP 7.4, WP Engine has decided to deprecate the htaccess file. See which alternatives we recommend to replace old htaccess directives.","breadcrumb":{"@id":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/support\/htaccess-deprecation\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/#primaryimage","url":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","contentUrl":"https:\/\/wpengine.com\/support\/wp-content\/uploads\/2019\/12\/wp-engine-featured-image.png","width":1200,"height":630,"caption":"WP Engine"},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/support\/htaccess-deprecation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/support\/"},{"@type":"ListItem","position":2,"name":"Support Posts","item":"https:\/\/wpengine.com\/support\/support\/"},{"@type":"ListItem","position":3,"name":".htaccess Deprecation and Alternatives"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/support\/#website","url":"https:\/\/wpengine.com\/support\/","name":"Support Center","description":"WP Engine&#039;s Support Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support\/97685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/types\/support"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/media\/126216"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/media?parent=97685"}],"wp:term":[{"taxonomy":"support-categories","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support-categories?post=97685"},{"taxonomy":"support-tag","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/support-tag?post=97685"},{"taxonomy":"mediapress_author","embeddable":true,"href":"https:\/\/wpengine.com\/support\/wp-json\/wp\/v2\/mediapress_author?post=97685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}