Thread: shortcuts?

    #1
  1. No Profile Picture
    rubbish in javascript
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    London
    Posts
    703
    Rep Power
    14

    Question shortcuts?


    hello

    not sure which forum i should be asking this in but i need to figure out a way to create shortcuts on my server to particular addresses.

    for example i will have something at..

    http://www.mysite.com/projects/projectone/index.php
    but i want it to show up at...
    http://www.mysite.com/projectone/index.php

    now i know i could create a page index.php at...

    http://www.mysite.com/projects/index.php

    which could refer to the correct address but that will still show the real address or of course i could have a frame which would mask the real address but i was wondering is there another way to do this perhaps via the .htaccess file???

    thanks in advance
    gar
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Posts
    310
    Rep Power
    13
    It has nothing to do with DNS; it's Apache... You should search for internal redirect under user "freebsd" in Apache section, he has answered it so many times..
  4. #3
  5. No Profile Picture
    rubbish in javascript
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    London
    Posts
    703
    Rep Power
    14
    hi

    ok from what i understood this is all apache stuff which i not alone dont understand but can't touch on my server due to the fact its a rented space.

    this is starting to get annoying now cos two weeks ago i needed to modify the php .ini and of course i'm not allowed do that ether.

    so at the risk of turning this into another question does anyone know of any hosts where you can rent space and you do have access to these types of files, or does that not exist??

    a+
    gar
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    of course this is possible. it just depends on how much you want to pay.
    you can even rent a server where you have administrator / root login

    this question should go to the "web-hosting" forum, but sorry, i will not follow you there (i boycott this forum due to the advertising there.)
    but i think this has been offered already there.

    another approach to your shortcut-problem:
    unix supports filesystem-based shortcuts:
    Code:
    /www/www.mysite.com/# ln -s projects/projectone .
    you can also create them from php script if you donīt have shell access
  8. #5
  9. No Profile Picture
    rubbish in javascript
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    London
    Posts
    703
    Rep Power
    14
    >you can also create them from php script if you donīt have shell access

    i dont!! is this under the filesystem functions i can do this?? what do i need to look for in the manual to do this??

    thanks
    gar
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    http://www.php.net/manual/en/function.symlink.php

    you probably need to login via ftp before, chmod the parent directory to 777 and after this you should chmod back to 755 (!)
  12. #7
  13. No Profile Picture
    rubbish in javascript
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    London
    Posts
    703
    Rep Power
    14
    mmm the explanation there is a bit on the minimal so i'm a bit vague about what exactly this does and how it works, at the moment i'm searching devshe for any other threads on "symlink" to see if i can get a clearer idea of what this does, if you know of any threads, tutorials etc i would appreciate the urls.

    sorry for being so dim but this is the first time i've ever done something with the filesyatem in php!!

    a+
    gar
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    you probably wonīt find much info on devshed about symlinks. they are a basic unix filesystem thing.
    similar to links in windows ("shortcut"), but they work better. a link to a directory is treated as directory.

    so:
    PHP Code:
    chdir("/www/..../www.yourhost.de");
    if (
    symlink("projects/projectone","./projectone")) {
      echo 
    "Symlink created.";
    } else {
      echo 
    "Symlink not created.";

    should do the job.
    as told earlier, login via ftp before and after to set the permissions!
  16. #9
  17. No Profile Picture
    rubbish in javascript
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    London
    Posts
    703
    Rep Power
    14
    i dont follow, i have very limited knowledge of windows systems and just begining to understand unix systems.

    in your code...
    chdir("/www/..../www.yourhost.de");

    i understand whats going on with a chdir() but the url you use has me confused - "/www/..../www.yourhost.de", ok i understand that "www.yourhost.de" should be replaced with my site url but why the "/www/...." before it? and why use the url when thats not the real address of my site which is more like "/home/sites/site170/users/garrett/web/collective"

    i did a test like so..

    $dir = getcwd();
    chdir("$dir/projects");
    $dir = getcwd();
    echo $dir;

    and i understand whats happening there, ie the current directory is changed for one beyond at "/projects" but after that i'm lost and cant figure out how to use this?

    what does the symlink actually create, a file? does this only last for the duration of this script?

    if*(symlink("projects/projectone","./projectone"))*{
    echo*"Symlink created.";
    }*else*{
    echo*"Symlink not created.";
    }

    thanks in advance
    gar
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    you should replace the path with the path to your www root. if you use a relative path, the script must be in the root.

    the symlink actually is a special file. it is like a text file that only contains the name of the other file. not really, but think of it like that.
    and it lasts until deleted. and it shows up in your ftp-client.

    additionally to this, apache needs to be setup to follow sym-links, sorry, forgot this. you need to ask your provider for this if it is not already activated. if you have htaccess configuration access, you probably can activate it yourself.

IMN logo majestic logo threadwatch logo seochat tools logo