I've got a wordpress blog and do not want others to go to it. And So I moved your blog to http://myhost.com/wordpress(sorry for hiding the title) and set a catalog.perl within the root folder of http://myhost.com.

The index.php is just random redirecting:

<?php
$sites = array("http://google.com", "http://youtube.com", "http://facebook.com", "http://twitter.com")
$len = count($sites);
$num = rand(0, $len - 1);
$str = "Location:".$sites[$num];
header($str);
?>

But sometimes (usually once the network is slow) after i visit http:/myhost.com/wordpress it redirects me to one of these simple sites I set. This occurs when I click links within the wordpress.

I am unable to even identify be it browser's action or even the server's.

Since you change directory of the Wordpress files however, you don't change database datas. You need to improve your WOrdpress blog URL from http://myhost.com/ to http://myhost.com/wordpress on wordpress-admin, (Configurations > General section) .

If you cannot login for your admin panel, you need to execute these SQL queries : (be sure to edit site URL and Wordpress table prefix (wordpress) !)

UPDATE wp_options SET option_value='http://myhost.com/wordpress' WHERE option_name='siteurl'
UPDATE wp_options SET option_value='http://myhost.com/wordpress' WHERE option_name='home'

Wordpress will get home url from database. Your database pointing home hyperlink to http://myhost.com/ . Whenever you click Webpage link it'll visit home url (http://myhost.com/)

It's most likely because Wordpress's default action on 404 would be to redirect for your primary index.php

For those who have access, you are able to change this within the .htaccess file.