Php 刚刚启动apache.htaccess重写到lighttpd转换
下面是apache中的.htaccess文件。我在我的子目录中发现了一个404NotFound错误,我确信这与我的重写有关Php 刚刚启动apache.htaccess重写到lighttpd转换,php,apache,.htaccess,mod-rewrite,lighttpd,Php,Apache,.htaccess,Mod Rewrite,Lighttpd,下面是apache中的.htaccess文件。我在我的子目录中发现了一个404NotFound错误,我确信这与我的重写有关 Options -Indexes Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1
Options -Indexes
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* file.php [L,QSA]
</IfModule>
我知道“$1.php”不是正确的答案。这是可行的,但我不认为它是有功能的。这里的唯一目的是帮助我完成我的工作。
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
看
为了
因为-f和-d参见url。如果不是文件,请重写
对于QSA,使用lighttpd条件块匹配查询字符串,然后用%1替换,例如
$HTTP["querystring"] =~ "(.*)" {
url.rewrite-if-not-file = ( "..." => "...&%1" )
} else {
url.rewrite-if-not-file = ( "..." => "..." )
}
$HTTP["host"] == "example.com" {
url.redirect = ( "^(.*)$" => "http://www.example.com$1" )
}
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* file.php [L,QSA]
$HTTP["querystring"] =~ "(.*)" {
url.rewrite-if-not-file = ( "..." => "...&%1" )
} else {
url.rewrite-if-not-file = ( "..." => "..." )
}