开发者

.htaccess RewriteCond -s (file exists)

开发者 https://www.devze.com 2023-02-15 08:22 出处:网络
I\'m开发者_如何转开发 pulling my hair out... Trying to get Drupal Boost to work on a live environment.It works on my development machine, but having problems in getting it to work live.

I'm开发者_如何转开发 pulling my hair out...

Trying to get Drupal Boost to work on a live environment. It works on my development machine, but having problems in getting it to work live.

It relies on an .htaccess rewrite rule to check if there is a static html file in a cache directory, and if it does, rewrite using this file.

I have stripped everything but the core rewrite rules, so it looks likes this:

RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

It is the rewrite condition that doesn't appear to be working (checking what happens on my dev environment compared to the live one). Essentially it is checking to see if %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}.html exists in the file system (using the -s flag).

From apache:

"Treats the TestString as a pathname and tests whether or not it exists, and is a regular file with size greater than zero."

I have:

  1. Ensured that the files exist
  2. Checked the file permissions (even though this shouldn't matter as it is apache checking files apache has created)
  3. Tried changing %{DOCUMENT_ROOT} for a hard coded path e.g. /var/www/vhosts/mywebsite.com/httpdocs/cache/normal/www.mywebsite.com/

Can anyone suggest a way forward, or anything to try to resolve this?

I have looked on Drupal Forums, but it seems to me to be a .htaccess problem.

Has anyone had experience of using -s?


Can you get to the actual html file?

example.com/cache/normal/example.com/_.html

0

精彩评论

暂无评论...
验证码 换一张
取 消