1
将网站移动到运行apache 2.4的新服务器后,此网站不再有效并且出现500服务器错误。.htaccess在apache上重定向循环2.4
目前的.htaccess文件如下:通过仅仅改变
<div role="main">
<?php
// Defualt page will always be home.html
$page = 'home';
// Lets get pages based on user input
if (!empty($_GET['name'])) {
//Assign a variable to a sanitised version of the data passed in the URL
$tmp_page = basename($_GET['name']);
//If the file exists, update $page
if (file_exists("pages/{$tmp_page}.html"))
$page = $tmp_page;
//If the file does not exist, include our custom notfound page and don't run anymore code
elseif(!file_exists($tmp_page)){
include("pages/notfound.html");
exit;
}
}
// Include our default page declared above if no data is passed (no clicks on menu)
include("pages/$page.html");
?>
</div>
我一直没能解决这个问题:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?name=$1 [L]
在index.php文件处理的网址如下的.htaccess。我只是托管网站,所以理想情况下,我不想在未经设计师同意的情况下对网站进行更改。
看看你的第一个条件/规则对...它基本上是说:如果请求实际上是现有的物理文件,然后重写该文件。当然这是一个重写循环... – arkascha