Page 1 of 1

odd problem

Posted: Sun Oct 29, 2006 7:59 pm
by pgolovko
I dont even know if its related to PHP or Apache ....

Code: Select all

$links_total = mysql_num_rows(mysql_query('SELECT `id` FROM `links`'));
The above code works and gives me the correct count from `links` table if I execute the file as http://server.com/index.php, yet it fails if I execute it as http://server.com/
The following code works in both cases:

Code: Select all

$pages_total = mysql_num_rows(mysql_query('SELECT `id` FROM `pages`'));
My ./htaccess file is:

Code: Select all

RewriteEngine on

RewriteRule ^(.*)/$ index.php?path=$1 [QSA,L]
RewriteRule ^/$ index.php [QSA,L]
RewriteRule ^(.*)/index([0-9]+).html$ index.php?path=$1&page=$2 [QSA,L]
RewriteRule ^index.html$ index.php [QSA,L]
I'm lost. Whats going on here? :?

Posted: Mon Oct 30, 2006 1:13 am
by timvw
'Fail' is not a good description for your problem. Exactly what are you expecting? And what are you actually recieving?

(PS: the better query would be select count(id) from links.)

Posted: Mon Oct 30, 2006 1:18 am
by n00b Saibot
i suppose the problem is in your code outside of what you have shown here. can you paste the code for the page?

Posted: Mon Oct 30, 2006 2:24 am
by itsmani1
you need to look at "DirectoryIndex directive" of your httpd.conf file

Posted: Mon Oct 30, 2006 6:28 pm
by RobertGonzalez
itsmani1 wrote:you need to look at "DirectoryIndex directive" of your httpd.conf file
Agreed. This directive is controlled by what your Apache config file is told to do with file extensions presented as a Directory Index.