473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Problem Using PHP for Server Files Redirect

We are trying to set up a PHP page to handle server requests for
individual web pages that we are moving to a new server. The part that
complicates this procedure is that the files will not be mirrored on the
new server. Instead many will be residing in new directories and
subdirectories than they were in on the old server.

What we wanted to do was when someone requested a specific page from our
old server, it would recognize the non-existent page and send it to the
redirect.php page that we created. That part works fine. Unfortunately,
PHP is unable to see what page originally was requested. I thought it
would see one page back, but it doesn't.

Is there any way to get the redirect.php to identify what the called for
page was so it can redirect it forward to the place the file resides in
on new server properly? I know this would be simple if this was from a
form but it's not.

Any suggestions would be appreciated.

Jul 17 '05 #1
1 3806
JDJones <se******@sprynet.com> writes:
We are trying to set up a PHP page to handle server requests for
individual web pages that we are moving to a new server. The part that
complicates this procedure is that the files will not be mirrored on the
new server. Instead many will be residing in new directories and
subdirectories than they were in on the old server.

What we wanted to do was when someone requested a specific page from our
old server, it would recognize the non-existent page and send it to the
redirect.php page that we created. That part works fine. Unfortunately,
PHP is unable to see what page originally was requested. I thought it
would see one page back, but it doesn't.
Is redirect.php on the old server or on the new one? How are you
invoking redirect.php for non-existent pages, and how did you try
to get PHP to "see one page back"?

Are you using PHP as an Apache module? If so, and if you added
something like "ErrorDocument 404 /redirect.php" to the Apache
configuration on the old server, then the original request should
be available in $_SERVER['REDIRECT_URL'] and $_SERVER['REQUEST_URI'].
Is there any way to get the redirect.php to identify what the called for
page was so it can redirect it forward to the place the file resides in
on new server properly? I know this would be simple if this was from a
form but it's not.


Do you have a reason for doing the redirects with PHP instead of
using whatever redirect capabilities the web server has? If you're
using Apache then you might be able to use the Redirect* directives
from mod_alias or the Rewrite* directives from mod_rewrite.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jake | last post by:
Hi All, > Hi experts, > > I am trying to build a page that allows file uploading from a browser > My ISP where the page will be located, only supports Smartupload > I am testing on a small...
5
by: fripper | last post by:
I posted this problem a couple of days ago but felt I might have better luck re-stating the problem. Apparently I messed up IIS (v. 5) somehow because I am suddenly unable to load web forms! A...
0
by: Tomas Vera | last post by:
Hello All, I've developed a Commerce Server application and am having deployment problems. The issue is not Commerce Server specific, so I'll ask here, since questions get answered here. The...
11
by: ElmoWatson | last post by:
I tried on the Security newgroup, as well as other places, and haven't gotten an answer yet - - I'm pulling my hair out over this one. I'm trying to get Forms Authentication working.....I can get...
3
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
3
by: Ohad Young | last post by:
Hi, I have a frameset page that contains two frames: 1. the first frame, an aspx page, contains a menu for navigating in the website. 2. the second frame contains content, pdf, html or other...
10
by: Brian Henry | last post by:
Hi, I am having a problem with an attachment system I made... it works with files up to ~3MB in size then after that if you try to upload a file it just goes to a "Page can not be displayed" page...
10
by: Don Munroe | last post by:
This one has me stumped. I have three web applications running on two different servers. The first that works fine is hosted by a .Net hosting company. Everyone that uses it has no problems...
2
by: Charl | last post by:
Hello, I’ve got a very strange but big deployment problem. I’ve written an asp.net application with an usercontrol on a webform. The usercontrol reads all picture names out of a mssql...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.