[wp-trac] [WordPress Trac] #39866: faulty .htaccess file being created

WordPress Trac noreply at wordpress.org
Mon Feb 13 20:55:26 UTC 2017


#39866: faulty .htaccess file being created
-----------------------------+----------------------
 Reporter:  dutchovendoctor  |       Owner:
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Rewrite Rules    |     Version:  4.7.2
 Severity:  normal           |  Resolution:  invalid
 Keywords:                   |     Focuses:
-----------------------------+----------------------
Changes (by swissspidy):

 * status:  new => closed
 * focuses:  accessibility =>
 * component:  General => Rewrite Rules
 * milestone:  Awaiting Review =>
 * resolution:   => invalid


Old description:

> 4.7.2 continually rewrites .htaccess file to the following content not
> compatible with Mozilla nor Explorer
>
> {{{
> # BEGIN WordPress
> AddHandler application/x-httpd-php70s .php
> <IfModule mod_expires.c>
>         ExpiresActive On
>         ExpiresByType image/jpg "access plus 1 year"
>         ExpiresByType image/jpeg "access plus 1 year"
>         ExpiresByType image/gif "access plus 1 year"
>         ExpiresByType image/png "access plus 1 year"
>         ExpiresByType text/css "access plus 1 month"
>         ExpiresByType application/pdf "access plus 1 month"
>         ExpiresByType text/javascript "access plus 1 month"
>         ExpiresByType image/x-icon "access plus 1 year"
>         ExpiresDefault "access plus 1 weeks"
> </IfModule>
> Options -Indexes
> <IfModule mod_rewrite.c>
>         RewriteEngine On
>         RewriteBase /
>         RewriteRule ^/wp-content/endurance-page-cache/ - [L]
>         RewriteCond %{REQUEST_METHOD} !POST
>         RewriteCond %{QUERY_STRING} !.*=.*
>         RewriteCond %{HTTP_COOKIE}
> !(wordpress_test_cookie|comment_author|wp\-postpass|wordpress_logged_in|wptouch_switch_toggle|wp_woocommerce_session_)
> [NC]
>         RewriteCond %{DOCUMENT_ROOT}/wp-content/endurance-page-
> cache/$1/_index.html -f
>         RewriteRule ^(.*)$ /wp-content/endurance-page-
> cache/$1/_index.html [L]
> </IfModule>
> <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
>
> ======================
> The fix is only use
> =======================
> # 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>
> }}}

New description:

 4.7.2 continually rewrites .htaccess file to the following content not
 compatible with Mozilla nor Explorer

 {{{
 # BEGIN WordPress
 AddHandler application/x-httpd-php70s .php
 <IfModule mod_expires.c>
         ExpiresActive On
         ExpiresByType image/jpg "access plus 1 year"
         ExpiresByType image/jpeg "access plus 1 year"
         ExpiresByType image/gif "access plus 1 year"
         ExpiresByType image/png "access plus 1 year"
         ExpiresByType text/css "access plus 1 month"
         ExpiresByType application/pdf "access plus 1 month"
         ExpiresByType text/javascript "access plus 1 month"
         ExpiresByType image/x-icon "access plus 1 year"
         ExpiresDefault "access plus 1 weeks"
 </IfModule>
 Options -Indexes
 <IfModule mod_rewrite.c>
         RewriteEngine On
         RewriteBase /
         RewriteRule ^/wp-content/endurance-page-cache/ - [L]
         RewriteCond %{REQUEST_METHOD} !POST
         RewriteCond %{QUERY_STRING} !.*=.*
         RewriteCond %{HTTP_COOKIE}
 !(wordpress_test_cookie|comment_author|wp\-postpass|wordpress_logged_in|wptouch_switch_toggle|wp_woocommerce_session_)
 [NC]
         RewriteCond %{DOCUMENT_ROOT}/wp-content/endurance-page-
 cache/$1/_index.html -f
         RewriteRule ^(.*)$ /wp-content/endurance-page-cache/$1/_index.html
 [L]
 </IfModule>
 <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
 }}}

 The fix is to only use:

 {{{
 # 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>
 }}}

--

Comment:

 Hey there,

 By default WordPress really only creates these .htaccess rules.

 {{{
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 }}}

 Anything else is not standard WordPress stuff. In your example, like
 `ExpiresByType` or `RewriteRule ^(.*)$ /wp-content/endurance-page-
 cache/$1/_index.html [L]`  is caused by plugins. Most likely by the
 `endurance-page-cache` plugin, which appears to be one installed on
 BlueHost, see https://github.com/bluehost/endurance-page-cache.

 In this case, I suggest you to talk to your host about it.

 In the future, the WordPress.org support forums at wordpress.org/support
 are better suited for questions like these.

 Cheers!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39866#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list