Changing base uri for relative paths

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
osita
Forum Newbie
Posts: 2
Joined: Tue Feb 17, 2009 8:16 am

Changing base uri for relative paths

Post by osita »

Hello,

Sorry for my newbie question, but I don't know how to do this.

I need the relative paths of certain content to point to http://server2/
For example, if I have

Code: Select all

<script type="text/javascript" src="../test.js"></script>
this should be relative on http://server2 instead of http://server1 (my actual url is http://server1)

I want to do this because before changing the source of an iframe I am processing the file and then printing the content inside...but fails when it tries to include other scripts because of the relative paths trying to load from server1..

Is this possible? Thanks!
User avatar
LanceEh
Forum Commoner
Posts: 46
Joined: Tue Feb 17, 2009 11:53 am
Location: Florida

Re: Changing base uri for relative paths

Post by LanceEh »

Take a look at $_SERVER['PHP_SELF'] Don't know if this is what you need but it might work.
osita
Forum Newbie
Posts: 2
Joined: Tue Feb 17, 2009 8:16 am

Re: Changing base uri for relative paths

Post by osita »

Thanks for your reply..finally what I want it is possible modifying the .htaccess in APACHE and adding redirecting rules :D
Post Reply