2 site one host ... and one problem



Hello all.
I have 2 sites: 1.com and 2.com.

This site are hosting to the same directory. 1.com/test.php=2.com/test.php

I have more then 5000 th pages (.php).
I want a script: if i acces 1.com/a_file.php to redirect me to 2.com/a_file.php ( 1.com/other.php to 2.com/other.php ... etc etc)

a_file.php it's one of the 5000's pages ( i want to work for all pages).

Who help me?

10x to all.
I am boggled as to why anybody would have 5,000 PHP files (that much content should be stored in a database with a CMS), but I digress. The better solution to your problem would be to use Apache to redirect the user. I think the RedirectMatch will do what you want. My regexes are a bit fuzzy, but I think this would do the trick:

RedirectMatch (.*) http://www.2.com/$1

The above would go in your httpd.conf or a .htaccess file on the 1.com server.
10x, but i don't have acces to apache.. I have acces to the directory of the site /site etc. I want a mini script to do this... So...
you just place a ".htaccess" file in the dirrectory and it will do the job... in that .htaccess file you should write the string that swirlee talked about..

You dont need access to apache to do this..
But i'm new of php, and i don't know to do this file. Can you create for me, and i just to put on my sevrer? Please..
upload any txt file to the server.. that txt file should contain that string..

then you should rename the file on the server with your ftp program to .htaccess

note -- you will have problems with renaming files on the windows machine..
Normal a page is loading in 2 seconds.With .httacces file is loading in 1 minute.
I want a scritp in php to includ @ the start of the page and to execute..if the site is 1.com to chage to 2.com.