Apache 仅当文件存在且是GET请求时重写
我正在开发一个PHPCMS,目前正在实现一个静态文件缓存。缓存背后的思想是,所有页面都被编译成html,然后由apache或nginx提供服务。问题是,如果它不是GET请求,它仍然应该被重写到PHPCMS,而不是直接提供服务。这是我当前的htaccess配置,我删除了HTTPS重定向Apache 仅当文件存在且是GET请求时重写,apache,.htaccess,Apache,.htaccess,我正在开发一个PHPCMS,目前正在实现一个静态文件缓存。缓存背后的思想是,所有页面都被编译成html,然后由apache或nginx提供服务。问题是,如果它不是GET请求,它仍然应该被重写到PHPCMS,而不是直接提供服务。这是我当前的htaccess配置,我删除了HTTPS重定向 <IfModule mod_rewrite.c> RewriteEngine On # If the requested filename exists, simply serve i
<IfModule mod_rewrite.c>
RewriteEngine On
# If the requested filename exists, simply serve it, but only if it is a GET request
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_METHOD} =GET
RewriteRule ^ - [L]
# Rewrite all other queries to the front controller.
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
有人能帮我找出问题所在吗?您的上一条规则创建了一个无限重写循环 解决方法:不要对基本索引应用规则
RewriteCond %{REQUEST_URI} !/index\.php$ [NC]
RewriteRule ^ %{ENV:BASE}/index.php [L]
除了
GET
RewriteCond %{REQUEST_URI} !/index\.php$ [NC]
RewriteRule ^ %{ENV:BASE}/index.php [L]