Change server path?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tsg
Forum Contributor
Posts: 142
Joined: Sun Jan 12, 2003 9:22 pm
Location: SE, Alabama
Contact:

Change server path?

Post by tsg »

Hey all,

I have a client that now after I have developed the website, they added all the content, created hundreds of pages, are wanting to move to another server.

In all the pages that are created, basically the create:

Code: Select all

<?
$page_id = 65;
include "/home/user/public_html/pages/index.php";
?>
Well, the new server, the paths are not even close. Is there a way to change the path on that server? a mod rewrite or something?

Thanks,
Tim
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

this is why it's recommended to use relative includes, versus literal. You will need to fix the code parts. Using a rewrite or other thing simply hides the problem and takes longer (granted not a lot) to process.
tsg
Forum Contributor
Posts: 142
Joined: Sun Jan 12, 2003 9:22 pm
Location: SE, Alabama
Contact:

Post by tsg »

Thanks, but I am looking for an alternative to changing the path on hundreds of pages. Is there another way to do it? With a rewrite? If so, can someone point me in the right direction for this?

Thanks,
Tim
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the only way it may be possible is through a symlink, which you may not be allowed to create. It's best to just fix the files. There are editors/tools out there that can find and replace things (using regular expressions sometimes too) among a large group of files.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

You should be able to create a script to open all the files and modify them.
Post Reply