Jump to content

Recommended Posts

Hello,

 

I have an advanced system which has folders with up to 8 folders deep :  http://192.168.0.1/webserver/dddf/dfdsfdf/sdfsdfsd/fdsfds/fsdfsdfdf/dfdsf/dfdf/sdfdf/

 

and it is very untidy for the user.

 

How can i replace the url not actually go to that url but just replace it with http://192.168.0.1/webserver/

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/50953-replace-url/
Share on other sites

You need to set up an alias for that folder on the webserver...which if the folders are dynamic this will not work....

 

If they are dynamic you could use the scandir() function to get a directory listing... then you would put the folder that the user wants to goto into a variable and when they go there you just send them there via header() function....

 

 

example:

directory: test

sub-dir: stest1

sub-dir: stest2

 


$dir = scandir('/usr/local/www/apache22/data/test');
$i_total=count($dir);

for ($i=0; $i<$i_total; $i++) {

echo "<a href=\"http://192.169.0.1/$dir[$i]/\">" . $dir[$i] . "</a><br>";

}

 

will give you an output of:

 

stest1

stest2

 

as links and then they will take you to that directory...

 

im not sure if this is what your looking for but you can also use the header() function to do something similar by populating the directory into a variable then use the header() function to send them to that folder.

 

Link to comment
https://forums.phpfreaks.com/topic/50953-replace-url/#findComment-250686
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.