Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Apache.htaccess中的规则重写为lighttpd标准_Apache_.htaccess_Mod Rewrite_Url Rewriting_Lighttpd - Fatal编程技术网

将Apache.htaccess中的规则重写为lighttpd标准

将Apache.htaccess中的规则重写为lighttpd标准,apache,.htaccess,mod-rewrite,url-rewriting,lighttpd,Apache,.htaccess,Mod Rewrite,Url Rewriting,Lighttpd,我是新来的lighttpd,我在.htaccess上遇到了问题,我知道它和Apache不一样,你必须在lighttpd.conf中进行更改,所以我尝试重写规则,但由于某种原因它们不起作用 这是我在Apache中的.htaccess文件,我希望您能将其转换为lighttpd,使其在我的服务器上工作,以便index.php以/index的形式打开,我尝试了url.rewrite-once=(“^index$”=>“/index.php”),但它不工作,所以请如果你能转换至少以下,如果你有时间为其他转

我是新来的lighttpd,我在.htaccess上遇到了问题,我知道它和Apache不一样,你必须在lighttpd.conf中进行更改,所以我尝试重写规则,但由于某种原因它们不起作用

这是我在Apache中的.htaccess文件,我希望您能将其转换为lighttpd,使其在我的服务器上工作,以便index.php
/index
的形式打开,我尝试了
url.rewrite-once=(“^index$”=>“/index.php”)
,但它不工作,所以请如果你能转换至少以下,如果你有时间为其他转换以及他们。顺便说一句,只是想让你知道,我从modules.conf启用了
mod_rewrite
,因此可以使用重写规则,但正如我所说,我无法正确转换它们,或者我不知道我做错了什么

ErrorDocument 404 /error.php
RewriteRule ^index$ /index.php [L]
RewriteRule ^view_news/([^/]*)$ /news.php?id=$1 [L]



ErrorDocument 404 /error.php - NOT SOLVED

RewriteCond %{HTTP_HOST} ^your-site\.com$ NOT SOLVED
RewriteRule ^(.*)$ http://www.your-site.com/$1 [R=301,L] - NOT SOLVED

RewriteRule ^index$ /index.php [L] - SOLVED
RewriteRule ^view_news/([^/]*)$ /news.php?id=$1 [L] - SOLVED

在我看来,在您提供的示例中,您应该有
url.rewrite-once=(“^/index$”=>“/index.php”)
(添加一个前导的
/
)。同样的情况也适用于查看新闻,比赛中应该包括最前面的斜杠。Macattack-thank's allot man,如果你有时间,我看到你对lighttpd有很好的了解,你能留下一些联系方式吗?我可以与你联系,电子邮件会很好…)如果你发布你为每个人做了什么,你期望他们做什么,以及他们似乎在做什么,我可以指出我看到的任何错误。我不会仅仅转换它们,因为它不是一个发布“为我做这件事”请求的网站。另外,我不知道Apache重写语法,所以我甚至不知道上面的规则是什么意思。我得到了最正确的答案,但我对404错误页面有一个问题,在Apache中是这个ErrorDocument 404/error.php,但不知道lighttpd,所以我不想知道如何禁止surten文件夹…server.error-handler-404=“/error-404.php”-你知道为什么这不起作用吗?