View Single Post

  #1 (permalink)  
Old 07-16-2007, 04:55 PM
Lizard King Lizard King is offline
Junior Member
User
 
Join Date: Jul 2007
My distro: CentOs
Posts: 4
Rep Power: 0
Lizard King is on a distinguished road
Default Redirect + Rewrite Problem in Lighttpd

Hi ,

Last week i decided to move from apache to lighttpd and i really like the decision i made because of the result. However couple small problems left. I will try to explain them one by one. I am using vBulletin 3.6.7 PL1 with vBSEO enabled.
I have arcade in my board and it uses index.php to send game scores. However this causes a problem with lighttpd. The code i have for arcade score submitting is
PHP Code:
// ibProArcade
if($_POST['module'] == "pnFlashGames")
{
        require_once(
'./global.php');

        switch(
$_POST['func'])
        {
                case 
"storeScore":
                
$_GET['act'] = "Arcade";
                
$_GET['module'] = "arcade";
                
$_GET['do'] = "pnFStoreScore";
                break;

                case 
"saveGame":
                
$_GET['do'] = "pnFSaveGame";
                break;

                case 
"loadGame":
                
$_GET['do'] = "pnFLoadGame";
                break;

                case 
"loadGameScores":
                
$gid $vbulletin->input->clean_gpc('p''gid'TYPE_NOHTML);
                
$uid$vbulletin->userinfo['userid'];
                
$game $db->query_first("SELECT * FROM " TABLE_PREFIX "games_scores WHERE mid=$uid AND gid = $gid ORDER BY score DESC LIMIT 0,1");
                
$scores $game[score];

                if(
$scores != false)
                {
                        
//Return true
                        
print "&opSuccess=true&gameScores=$scores&endvar=1"//send endvar to keep opSuccess separate from all other output from PostNuke
                
}
                else
                {
                        print 
"&opSuccess=false&error=Error&endvar=1";
                }
                break;
        }
}

$act $_GET[act];
$autocom $_GET[autocom];
$showuser$_GET[showuser];
if(
$act == "Arcade" || $autocom=="arcade") {
include 
"arcade.php";
exit();
}
if(!empty(
$showuser) && $showuser >= 1) {
$u $showuser;
$_GET[u] = $showuser;
include 
"member.php";
exit();
}

// end of ibProArcade 
I searched around and found a solution with apache. The following code needs to be added to .htaccess but i couldn't figure out how to do it.
Code:
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{THE_REQUEST} "T /index.php"
RewriteCond %{QUERY_STRING} ^$
RewriteRule .* http://www.yourdomain.com/ [L,R=301]
I tried the following versions but unfortunately domain.com gives blank page however doman.com/index.php is working. This is what i have in my lighttpd.conf
Code:
url.redirect = (
    "^/index\.php?(.*)$" => "http://www.ayyas.com/"
)
This is also what i have for vbseo and other rewrite rules in my lighttpd.conf
Code:
url.rewrite-once = (
"^/blogs/([-a-z0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)\.html(?:\?(.*))?" => "/blogs/viewblog.php?username=$1&month=$3&year=$2&day=$4",
"^/blogs/([-a-z0-9]+)/([0-9]+)/([0-9]+)/(?:\?(.*))?" => "/blogs/viewblog.php?username=$1&month=$3&year=$2",
"^/blogs/([-a-z0-9]+)/category/([,0-9]+)\.html(?:\?(.*))?" => "/blogs/viewblog.php?username=$1&categoryid=$2",
"^/blogs/([-a-z0-9]+)/arsiv\.html(?:\?(.*))?" => "/blogs/viewblog.php?username=$1&displaymode=archive",
"^/blogs/([-a-z0-9]+)/([-a-zA-Z0-9_]+)-([0-9]+)/yorum-([0-9]+)\.html(?:\?(.*))?" => "/blogs/viewblog.php?username=$1&entrytitle=$2&entry=$3&c=$4",
"^/blogs/([-a-z0-9]+)/([-a-zA-Z0-9_]+)-([0-9]+)/(?:\?(.*))?" => "/blogs/viewblog.php?username=$1&entrytitle=$2&entry=$3",
"^/blogs/([-a-z0-9]+)/$(?:\?(.*))?" => "/blogs/viewblog.php?username=$1",
"^/tags/([0-9]+)/(.+)$(?:\?(.*))?" => "/tags/index.php?tag=$1&page=$2",
"^/tags/(.+)$(?:\?(.*))?" => "/tags/index.php?tag=$1",
"^/(sitemap.*\.(xml|txt)(\.gz)?)$" => "/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1",
"^(/(highslide|tags|xcache|geek|gars|stats|mert|serenity|cey|arcade|mysmiliesvb|admincp|modcp|clientscript|cpstyles|images|sonstil|kirmizi|files|galeri|vampir|summer|avatars|attachments|custompics|customavatars)/.*)$" => "$1",
"^/(archive/.*)$" => "/vbseo.php?vbseourl=$1",
"^(.*clear\.gif)$" => "$1",
"^/(.+)\?(.*)$" => "/vbseo.php?vbseourl=$1&$2",
"^/(.+)$" => "/vbseo.php?vbseourl=$1"
)
Within these rules everything is working without a problem on the board. However i have another site thats why i followed Howto: Lighttpd web server setting up virtual hosting | nixCraft as a tutorial and my virtual domain setting is as follow
Code:
$HTTP["host"] =~ "(^|\.)ayyas\.com$" {
server.document-root = "/home/lighttpd/ayyas.com/html"
server.errorlog = "/var/log/lighttpd/ayyas/error.log"
accesslog.filename = "/var/log/lighttpd/ayyas/access.log"
server.error-handler-404 = "/404.php"
}

$HTTP["host"] =~ "(^|\.)unownedband\.com$" {
server.document-root = "/home/lighttpd/unownedband.com/html"
server.errorlog = "/var/log/lighttpd/unownedband/error.log"
accesslog.filename = "/var/log/lighttpd/unownedband/access.log"
server.error-handler-404 = "/404.php"
}
If i don't add $HTTP["host"] == "ayyas.com" { around my rewrite rules then pages on unownedband.com doesn't work expect index.html . If i add $HTTP["host"] == "ayyas.com" around my rewrite rules then everything breaks on ayyas.com site.

I really need to solve this 2 problem. Any help will be appriciated.
Reply With Quote