how to include file which are located outside of the folderAccess and Display Images/ Prompt File Downloads that are located outside the application folderDude, where's my php.ini? (server config)php Include and path to other filesHow to include a php file into two others which are in different directories ? (not the other way around!).js files not being called on pages included in foldersHow to reference CSS file so it can be found using an include in PHPHow to Access PHP File in Separate Foldersaccess folder outside public-htmlFile pathing on a 'header.php' that is i placed on an include() function on different foldersHow to redirect (header location) to an html file?

Can multiple outlets be directly attached to a single breaker?

Is 12 minutes connection in Bristol Temple Meads long enough?

Are there any sonatas with only two sections?

Smooth function that vanishes only on unit cube

What is this minifig/minidoll (?)

How to make a not so good looking person more appealing?

Do Grothendieck universes matter for an algebraic geometer?

Fixed width with p doesn't work

Why are BJTs common in output stages of power amplifiers?

How to redirect stdout to a file, and stdout+stderr to another one?

Was the dragon prowess intentionally downplayed in S08E04?

How might a landlocked lake become a complete ecosystem?

Extract the characters before last colon

"The van's really booking"

Can a tourist shoot a gun for recreational purpose in the USA?

Why do the lights go out when someone enters the dining room on this ship?

Is it wrong to omit object pronouns in these sentences?

Why doesn't Iron Man's action affect this person in Endgame?

Were any of the books mentioned in this scene from the movie Hackers real?

Holding rent money for my friend which amounts to over $10k?

Why did the metro bus stop at each railway crossing, despite no warning indicating a train was coming?

Can you pick an advanced rogue talent with the Extra Rogue Talent feat?

Is there any way to adjust the damage type of the Eldritch Blast cantrip so that it does fire damage?

Can my Serbian girlfriend apply for a UK Standard Visitor visa and stay for the whole 6 months?



how to include file which are located outside of the folder


Access and Display Images/ Prompt File Downloads that are located outside the application folderDude, where's my php.ini? (server config)php Include and path to other filesHow to include a php file into two others which are in different directories ? (not the other way around!).js files not being called on pages included in foldersHow to reference CSS file so it can be found using an include in PHPHow to Access PHP File in Separate Foldersaccess folder outside public-htmlFile pathing on a 'header.php' that is i placed on an include() function on different foldersHow to redirect (header location) to an html file?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I have create my system of three folders



  • pages folder

  • style folder

  • images folder

and one index.php file.



My problem is how I can include index.php file in my file login.php which are found in pages folder.
I'm trying to header ("Location:index.php") don't work.
Not: this index.php is single file located outside of those folders



<?php
header ("Location:index.php");
?>









share|improve this question
























  • Use <?php header ("Location: ../index.php"); ?>

    – PHP Web
    Mar 23 at 15:12

















1















I have create my system of three folders



  • pages folder

  • style folder

  • images folder

and one index.php file.



My problem is how I can include index.php file in my file login.php which are found in pages folder.
I'm trying to header ("Location:index.php") don't work.
Not: this index.php is single file located outside of those folders



<?php
header ("Location:index.php");
?>









share|improve this question
























  • Use <?php header ("Location: ../index.php"); ?>

    – PHP Web
    Mar 23 at 15:12













1












1








1


1






I have create my system of three folders



  • pages folder

  • style folder

  • images folder

and one index.php file.



My problem is how I can include index.php file in my file login.php which are found in pages folder.
I'm trying to header ("Location:index.php") don't work.
Not: this index.php is single file located outside of those folders



<?php
header ("Location:index.php");
?>









share|improve this question
















I have create my system of three folders



  • pages folder

  • style folder

  • images folder

and one index.php file.



My problem is how I can include index.php file in my file login.php which are found in pages folder.
I'm trying to header ("Location:index.php") don't work.
Not: this index.php is single file located outside of those folders



<?php
header ("Location:index.php");
?>






php






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 16:36









dearsina

1,8471321




1,8471321










asked Mar 23 at 14:18









simkokosimkoko

24




24












  • Use <?php header ("Location: ../index.php"); ?>

    – PHP Web
    Mar 23 at 15:12

















  • Use <?php header ("Location: ../index.php"); ?>

    – PHP Web
    Mar 23 at 15:12
















Use <?php header ("Location: ../index.php"); ?>

– PHP Web
Mar 23 at 15:12





Use <?php header ("Location: ../index.php"); ?>

– PHP Web
Mar 23 at 15:12












2 Answers
2






active

oldest

votes


















0














Just make the URL's relative from the document root (by adding an initial /):



header('Location: /index.php');


or if you want to redirect to a sub folder:



header('Location: /theFolder/index.php');


Then you don't need to care what folder you're in and add a bunch of ../../.






share|improve this answer






























    0














    When traversing a folder tree, you can use ../ to denote a parent folder.



    . is a shortcut to 'the current folder'.
    .. is a shortcut to 'the folder containing the current folder'.



    Assuming the index.php file is in the parent folder of the login.php page, you can access it like so:



    header ("Location: '../index.php'");






    share|improve this answer

























    • What are the purpose of putting ../ at the starting?

      – simkoko
      Mar 23 at 14:23











    • Have a read of the description.

      – dearsina
      Mar 23 at 14:25











    • yes it work ! but I'm got confussion on what are the aim of putting ../ at the starting? and it's only two fullstop (..) not otherwise when you put one don't work three don't work.why?

      – simkoko
      Mar 23 at 14:30











    • ../ means "go one folder up". You can chain them, ../../ means go two folders up.

      – dearsina
      Mar 23 at 14:36











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314649%2fhow-to-include-file-which-are-located-outside-of-the-folder%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Just make the URL's relative from the document root (by adding an initial /):



    header('Location: /index.php');


    or if you want to redirect to a sub folder:



    header('Location: /theFolder/index.php');


    Then you don't need to care what folder you're in and add a bunch of ../../.






    share|improve this answer



























      0














      Just make the URL's relative from the document root (by adding an initial /):



      header('Location: /index.php');


      or if you want to redirect to a sub folder:



      header('Location: /theFolder/index.php');


      Then you don't need to care what folder you're in and add a bunch of ../../.






      share|improve this answer

























        0












        0








        0







        Just make the URL's relative from the document root (by adding an initial /):



        header('Location: /index.php');


        or if you want to redirect to a sub folder:



        header('Location: /theFolder/index.php');


        Then you don't need to care what folder you're in and add a bunch of ../../.






        share|improve this answer













        Just make the URL's relative from the document root (by adding an initial /):



        header('Location: /index.php');


        or if you want to redirect to a sub folder:



        header('Location: /theFolder/index.php');


        Then you don't need to care what folder you're in and add a bunch of ../../.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 at 14:52









        Magnus ErikssonMagnus Eriksson

        8,16141428




        8,16141428























            0














            When traversing a folder tree, you can use ../ to denote a parent folder.



            . is a shortcut to 'the current folder'.
            .. is a shortcut to 'the folder containing the current folder'.



            Assuming the index.php file is in the parent folder of the login.php page, you can access it like so:



            header ("Location: '../index.php'");






            share|improve this answer

























            • What are the purpose of putting ../ at the starting?

              – simkoko
              Mar 23 at 14:23











            • Have a read of the description.

              – dearsina
              Mar 23 at 14:25











            • yes it work ! but I'm got confussion on what are the aim of putting ../ at the starting? and it's only two fullstop (..) not otherwise when you put one don't work three don't work.why?

              – simkoko
              Mar 23 at 14:30











            • ../ means "go one folder up". You can chain them, ../../ means go two folders up.

              – dearsina
              Mar 23 at 14:36















            0














            When traversing a folder tree, you can use ../ to denote a parent folder.



            . is a shortcut to 'the current folder'.
            .. is a shortcut to 'the folder containing the current folder'.



            Assuming the index.php file is in the parent folder of the login.php page, you can access it like so:



            header ("Location: '../index.php'");






            share|improve this answer

























            • What are the purpose of putting ../ at the starting?

              – simkoko
              Mar 23 at 14:23











            • Have a read of the description.

              – dearsina
              Mar 23 at 14:25











            • yes it work ! but I'm got confussion on what are the aim of putting ../ at the starting? and it's only two fullstop (..) not otherwise when you put one don't work three don't work.why?

              – simkoko
              Mar 23 at 14:30











            • ../ means "go one folder up". You can chain them, ../../ means go two folders up.

              – dearsina
              Mar 23 at 14:36













            0












            0








            0







            When traversing a folder tree, you can use ../ to denote a parent folder.



            . is a shortcut to 'the current folder'.
            .. is a shortcut to 'the folder containing the current folder'.



            Assuming the index.php file is in the parent folder of the login.php page, you can access it like so:



            header ("Location: '../index.php'");






            share|improve this answer















            When traversing a folder tree, you can use ../ to denote a parent folder.



            . is a shortcut to 'the current folder'.
            .. is a shortcut to 'the folder containing the current folder'.



            Assuming the index.php file is in the parent folder of the login.php page, you can access it like so:



            header ("Location: '../index.php'");







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 23 at 14:39

























            answered Mar 23 at 14:21









            dearsinadearsina

            1,8471321




            1,8471321












            • What are the purpose of putting ../ at the starting?

              – simkoko
              Mar 23 at 14:23











            • Have a read of the description.

              – dearsina
              Mar 23 at 14:25











            • yes it work ! but I'm got confussion on what are the aim of putting ../ at the starting? and it's only two fullstop (..) not otherwise when you put one don't work three don't work.why?

              – simkoko
              Mar 23 at 14:30











            • ../ means "go one folder up". You can chain them, ../../ means go two folders up.

              – dearsina
              Mar 23 at 14:36

















            • What are the purpose of putting ../ at the starting?

              – simkoko
              Mar 23 at 14:23











            • Have a read of the description.

              – dearsina
              Mar 23 at 14:25











            • yes it work ! but I'm got confussion on what are the aim of putting ../ at the starting? and it's only two fullstop (..) not otherwise when you put one don't work three don't work.why?

              – simkoko
              Mar 23 at 14:30











            • ../ means "go one folder up". You can chain them, ../../ means go two folders up.

              – dearsina
              Mar 23 at 14:36
















            What are the purpose of putting ../ at the starting?

            – simkoko
            Mar 23 at 14:23





            What are the purpose of putting ../ at the starting?

            – simkoko
            Mar 23 at 14:23













            Have a read of the description.

            – dearsina
            Mar 23 at 14:25





            Have a read of the description.

            – dearsina
            Mar 23 at 14:25













            yes it work ! but I'm got confussion on what are the aim of putting ../ at the starting? and it's only two fullstop (..) not otherwise when you put one don't work three don't work.why?

            – simkoko
            Mar 23 at 14:30





            yes it work ! but I'm got confussion on what are the aim of putting ../ at the starting? and it's only two fullstop (..) not otherwise when you put one don't work three don't work.why?

            – simkoko
            Mar 23 at 14:30













            ../ means "go one folder up". You can chain them, ../../ means go two folders up.

            – dearsina
            Mar 23 at 14:36





            ../ means "go one folder up". You can chain them, ../../ means go two folders up.

            – dearsina
            Mar 23 at 14:36

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314649%2fhow-to-include-file-which-are-located-outside-of-the-folder%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript