| @@ -1935,9 +1935,15 @@ | ||
| 1935 | 1935 | |
| 1936 | 1936 | if (!got_mod_rewrite()) { |
| 1937 | 1937 | return; |
| 1938 | 1938 | } |
| 1939 | + | |
| 1940 | + $htaccess_path = $cache_dir . '.htaccess'; | |
| 1939 | 1941 | |
| 1942 | + if (!is_writable($htaccess_path)) { | |
| 1943 | + return; | |
| 1944 | + } | |
| 1945 | + | |
| 1940 | 1946 | $rules = <<<HTACCESS |
| 1941 | 1947 | Order allow,deny |
| 1942 | 1948 | Deny from all |
| 1943 | 1949 | |
| @@ -1956,9 +1962,9 @@ | ||
| 1956 | 1962 | Deny from all |
| 1957 | 1963 | </FilesMatch> |
| 1958 | 1964 | HTACCESS; |
| 1959 | 1965 | |
| 1960 | - file_put_contents($cache_dir . '.htaccess', $rules); | |
| 1966 | + file_put_contents($htaccess_path, $rules); | |
| 1961 | 1967 | |
| 1962 | 1968 | // Suppress directory listing |
| 1963 | 1969 | $index_stub = $cache_dir . 'index.php'; |
| 1964 | 1970 | if (!file_exists($index_stub)) { |
| @@ -1998,8 +2004,12 @@ | ||
| 1998 | 2004 | } |
| 1999 | 2005 | |
| 2000 | 2006 | $htaccess = get_home_path() . '.htaccess'; |
| 2001 | 2007 | $cache_tag_host = parse_url(home_url(), PHP_URL_HOST); |
| 2008 | + | |
| 2009 | + if (!is_writable($htaccess)) { | |
| 2010 | + return; | |
| 2011 | + } | |
| 2002 | 2012 | |
| 2003 | 2013 | // Match the cache-serving RewriteCond to the site's actual permalink convention, |
| 2004 | 2014 | // so caching works whether the site uses trailing slashes or not. |
| 2005 | 2015 | $permalink_structure = get_option('permalink_structure'); |