Page redirection using PHP?

Soldato
Joined
18 Oct 2002
Posts
5,832
Location
Liverpool :-)
Lo all,

i've got a domain, let's call it test.com for now with 000webhost.com. The server got hacked yesterday, it's only a test/project site for me to learn html/php etc so i deleted everything last night.

What i want is say someone sticks www.test.com into a browser, it will automatically take it to www.test.com/home.php. In the control panel for the hosting, i can't see anything to do this. At the moment it just takes them to the root of the directory with access to all the files.

Anyone got any ideas? Can i do this with PHP?

Ta :)
 
After reading about, it appears you can't just use the 301 redirect from the root to a new page. This does work, but i'm having a few problems with the images at the moment

RewriteBase /

RewriteEngine on
RewriteOptions MaxRedirects=2

# Also redirect the root folder.
RewriteCond %{HTTP_HOST} ^(www.)?test.co.uk$
RewriteRule ^(/)?$ currentsite/holding.php [L]

IndexIgnore *

This takes www.test.co.uk to www.test.co.uk/holding.php
 
Code:
RewriteBase /

RewriteEngine on
RewriteOptions MaxRedirects=2

# Also redirect the root folder.
# redirect does not apply to files/directories that actually exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^(www.)?test.co.uk$

RewriteRule ^(/)?$ currentsite/holding.php [L]

IndexIgnore *

I'd still change or add to the directoryindex, though - that's one line of code, versus your multiple ones
 
Well the wierd thing is now, whatever file i put into the root or folders and then view using a browser. Avg goes mad and say's it's infected! I'm using Wamp, if i scan the WWW directory, everything is fine!

I'm just running some virus scans now, this is got me really confused just as i had it working as well
 
can someone goto: and see what happens?

I've just mad the most basic of html files and it automatically puts the analytic code at the bottom, Avg tell's me it's infected!

Hardly basic when it contains exploit code?
 
Looks like it. I missed where it was located, I guess you didn't put it there then? :D
 
nothing to do with me, i suppose that's what you get with free hosting. I think i'll remove everything for now, there must be still a problem with all the sites getting hacked and redirected to the chinese website
 
Indeed, i just wanted a holding page to be up but i think i'll wait a while or possibly think about some other hosting
 
Back
Top Bottom