SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru defiance's Avatar
    Join Date
    Oct 2004
    Location
    United states
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    localhost redirect

    HI,


    how do i set up redirections in local machine.

    i know thati can set redirect online coz the cPanel have the Redirect icon..

    but in local machine i don have cPanel.

    so, i would like to have

    http://localhost to be directed to http://localhost/myfolder/


    thanks

  2. #2
    Awesome Addict
    Join Date
    Mar 2004
    Location
    Toronto, Canada
    Posts
    326
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you using Apache as your local server? If so, go to the www directory and create a file like this and save it as index.php:

    PHP Code:
    <?
    header
    ("Location: yourFolder/");
    ?>
    Now whenever you type http://localhost/ in your browser you will be redirected to http://localhost/yourFolder/.

    Hope that helps!

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    defiance,

    1. SitePoint has an EXCELLENT Apache forum and this post really should have been made there (for correct answers).

    2. Have a look at http://datakoncepts.com/seo for a brief summary of setting up Apache's mod_rewrite module and using it to create (and use) "user-friendly" URLs.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    SitePoint Guru defiance's Avatar
    Join Date
    Oct 2004
    Location
    United states
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh,


    apologies DK.

    can i post this thread there?

    or wait for mod to move it there?

    apologies once again.....

  5. #5
    SitePoint Guru defiance's Avatar
    Join Date
    Oct 2004
    Location
    United states
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gregor002
    Are you using Apache as your local server? If so, go to the www directory and create a file like this and save it as index.php:

    PHP Code:
    <?
    header
    ("Location: yourFolder/");
    ?>
    Now whenever you type http://localhost/ in your browser you will be redirected to http://localhost/yourFolder/.

    Hope that helps!

    that is a very nice trick.

    but i am pretty sure there are some non-trick.
    hehehe
    well

    thanks..
    and nice trick

  6. #6
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    defiance,

    NO need to apologize (to me or to anyone else)!!! I didn't know that there was an Apache forum until I did a search for SEO (Search Engine Optimization - otherwise known as "user-friendly" URLs) several months ago.

    Go ahead and post over there rather than waiting for a moderator to move this (which is not necessary).

    BTW, PHP's header(location) "trick" is just the http-equiv=refresh "trick" from basic HTML. What you need is to have Apache do the relocation for you (to the same filename in the subdirectory?).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •