Php 正在使用内部服务器错误重写url
我正在尝试使用.htaccess进行url重写,但问题是,当我单击链接时,地址栏上会显示url重写良好,但页面会显示此错误内部服务器错误,我已经打开了我需要在wamp中打开的必要内容(LoadModule rewrite\u module modules/mod\u rewrite.so)下面是我的代码,其中包含index.php、victions.php(包含类)、landing.php(在地址栏上显示url,但显示内部服务器错误)和.htaccessPhp 正在使用内部服务器错误重写url,php,.htaccess,mod-rewrite,url-rewriting,Php,.htaccess,Mod Rewrite,Url Rewriting,我正在尝试使用.htaccess进行url重写,但问题是,当我单击链接时,地址栏上会显示url重写良好,但页面会显示此错误内部服务器错误,我已经打开了我需要在wamp中打开的必要内容(LoadModule rewrite\u module modules/mod\u rewrite.so)下面是我的代码,其中包含index.php、victions.php(包含类)、landing.php(在地址栏上显示url,但显示内部服务器错误)和.htaccess index.php include_on
index.php
include_once("venues.php");
$venue = new venues;
$thedate = $venue->listAllVenue();
if (count($thedate)) {
for ($i =0; $i < count($thedate); $i++) {
$id = $list[$i]['id'];
<a href="<?php echo venues::theurl($list[$i]['id'], "venue"); ?>"><?php echo $list[$i]['venue_title']; ?></a>
}
venues.php
class venues{
function OneVenue($id, $point='id') {
$query = "SELECT * FROM venues WHERE id = '".$id."'";
$sql = mysql_query($query) or die (mysql_error());
if ($sql) {
$result = array();
$row = mysql_fetch_array($sql);
$result['id'] = $row['id'];
$result['venue_title'] = $row['venue_title'];
return $result;
} else {
return false;
}
}
function theurl($id, $point="", $type="") {
if ($point == "venue") {
$data = venues::OneVenue($id);
$id = $data['id'];
$thename = trim(strtolower($data['venue_title']));
$urlLink = explode(" ", $thename);
$sublink = implode("-", $urlLink);
$result = URL."venue-details/".$id."/".$sublink."/";
}
return $result;
}
}
landing.php
include_once("venues.php");
$venue = new venues;
if (isset($_REQUEST['id'])) {
$id = $_REQUEST['id'];
$pickvenue = $venue->OneVenue($id);
echo $pickvenue['venue_title'];
}
.htaccess
RewriteEngine on
RewriteRule ^venues/([a-zA-Z)([0-9]+)/(.*?)/$ venue-details?id=$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
index.php
包括_once(“victions.php”);
$VICENT=新场馆;
$thedate=$venture->listAllVenue();
如果(计数($thedate)){
对于($i=0;$iONEVENCE($id);
echo$pickvenue['venue_title'];
}
.htaccess
重新启动发动机
重写规则^VICENTES/([a-zA-Z]([0-9]+)/(.*)/$VICENTE details?id=$1
重写cond%{REQUEST_FILENAME}!-d
重写cond%{REQUEST_FILENAME}\.php-f
重写规则^(.*)$$1.php
您的索引页已断开
你的代码
include_once("venues.php");
$venue = new venues;
$thedate = $venue->listAllVenue();
if (count($thedate)) {
for ($i =0; $i < count($thedate); $i++) {
$id = $list[$i]['id'];
<a href="<?php echo venues::theurl($list[$i]['id'], "venue"); ?>"><?php echo $list[$i]['venue_title']; ?></a>
}
include_once(“victions.php”);
$VICENT=新场馆;
$thedate=$venture->listAllVenue();
如果(计数($thedate)){
对于($i=0;$i
为什么无效
if (count($thedate)) { // <- has no closing bracket
for ($i =0; $i < count($thedate); $i++) {
$id = $list[$i]['id'];
// the line below just starts hmtl output with no closing php tags
<a href="<?php echo venues::theurl($list[$i]['id'], "venue"); ?>"><?php echo $list[$i]['venue_title']; ?></a>
}
if(count($thedate)){//listAllVenue();
如果(计数($thedate))
{
对于($i=0;$i
仍然在Vincements.php中给我相同的错误(内部服务器错误)。您在$result=URL行中使用了一个全局变量URL
。“场馆详细信息/”。“$id.“/”。“/”$sublink./”;
您是否在某个地方明确设置了这个全局变量?它应该类似于定义('URL','www.mysite.com'));
或类似内容。同样在同一个文件中,您正在执行sql查询(顺便说一句,这很容易受到sql注入的影响),但我看不到任何连接到数据库函数的连接。
include_once("venues.php");
$venue = new venues;
$thedate = $venue->listAllVenue();
if (count($thedate))
{
for ($i =0; $i < count($thedate); $i++)
{
$id = $list[$i]['id'];
?>
<a href="<?php echo venues::theurl($list[$i]['id'], 'venue'); ?>"><?php echo $list[$i]['venue_title']; ?></a>
<?php
}
}