htaccess(www)没有工作(没有www)工作

时间:2014-07-07 11:03:36

标签: php .htaccess

没有www,没问题。使用www

给出404错误日志

PHP

<?php
header('Content-Type: text/html; charset=utf-8');
require_once('db.php');
$sefurl = mysql_escape_string($_GET['sef']);

if($sefurl==""){

$sefurl =  'homepage' ;

}else{

}

$sql = mysql_query("SELECT * FROM page WHERE sefurl='$sefurl'");
$data = mysql_fetch_assoc($sql);
        switch($data){
        case null;
        echo "<center><h1 style='font-size:500px'>404</h1></center>";
        break;
        default:
        .
        .
        ?>

htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ([A-Za-z0-9]+).website.com
RewriteRule ^$ index.php?sef=%1  


Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+).html$ index.php?sef=$1 [L,QSA]

为什么会出现此错误。是否有想法

1 个答案:

答案 0 :(得分:0)

更改

RewriteCond %{HTTP_HOST} ([A-Za-z0-9]+).website.com

RewriteCond %{HTTP_HOST} ([A-Za-z0-9]*).website.com