gpt4 book ai didi

php - 从 Apache 迁移后 IIS7 上出现链接错误

转载 作者:行者123 更新时间:2023-11-29 14:13:51 24 4
gpt4 key购买 nike

我将 PHP 应用程序从 Apache 迁移到 IIS7,所有链接都是从包含路径目录的 MySQL 表记录加载的。我的 PHP 代码和 MySQL 数据库具有相同的结构。但是,当我单击链接时,PHP 代码不会执行,它只在我的主页上运行。我收到以下错误:

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

这是 IIS 配置问题吗?

This is for the home page:

<ul>                  
<?php
echo $class->menu->topmenu( $patharray[0] ) ?>
</ul>

The following is for the link:

function topmenu ( $path = 'home' )
{
$home = $this->fetchOne ( $this->query( "SELECT * FROM admin_menu WHERE parent = 0" ) ) ;
$links = $this->fetch ( $this->query ( "SELECT admin_menu.*, aus.value FROM admin_menu LEFT JOIN admin_user_status aus ON ( aus.id = admin_menu.status ) WHERE parent = 1 AND active ='yes' ORDER BY sort ASC" ) ) ;

if ( $links )
foreach ( $links as $key => $link )
{

if ( $key == 0)
$url = '/';


else
$url = $link->url;

//if ( $link->priv == 'open' || ( $link->priv == 'private' && $this->userinfo->status == 225 ) )
if( $this->check_user_priv( $link ) )
{
if( stripos( $link->url, $path ) === false )
$result .= "<li class='mainlevel'><a href='$url' >$link->text</a></li>" ;
else
$result .= "<li class='mainlevel'><b><a href='$url' >$link->text</a></b></li>" ;
}


}


return $result;
}

The url links above are loaded from the table, but when I click on them I get the HTTP Error 404.0 - Not Found.

最佳答案

I solved my problem by importing Apache mod_rewrite Rules into the URL Rewrite Module in IIS 7. My migration from Apache had .htaccess rules that needed to be converted for the web.config. I hope this helps someone else.

关于php - 从 Apache 迁移后 IIS7 上出现链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13016926/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com