Ubuntu 14.04 - Maintaining old file paths after moving document root?












0















I have a server running Ubuntu 14.04 and a LAMP Stack. It's working, I am able to upload my javascript and php script to the html folder and I'm able to see my web site if I go to www.MySiteHere.com and the various folders under it.



I've recently made a new site using Grav. I have installed Grav in my server, and I've uploaded our new site. I want the new site to load automatically once our site is visited, and the way I did this was to change the document root to:



/var/www/html/GravFolder/


In this way, whenever I loaded www.MySiteHere.com, the new Grav site loads. This solution works.



However, the problem now is this: Since I moved the document root to the Grav Folder, I am now unable to access the other folders in the html folder, some of which contain php code that are important to our operations.



Let me illustrate the folder structure:



/var/root/html
|--> index.html <-- old index file
|--> GravFolder
|--> index.php <-- new index file
|--> folder_with_php_code
|--> fileUpload.php <-- impt php file


If the Document Root points to just the /html folder, I have no problems with the fileUpload.php file. I can go to www.MySiteHere/folder_with_php_code/fileUpload.php and I'll see my php upload page. But the Grav page would be accessible through www.MySiteHere.com/GravFolder, instead of www.MySiteHere.com



But since I want the new Grav site to be my new index, I point the Document Root to /html/GravFolder. This makes www.MySiteHere.com load the Grav Site I made, but in turn, when I try to go to www.MySiteHere/folder_with_php_code/fileUpload.php, it gives me a 404, because the server interprets the url as:



www.MySiteHere/GravFolder/folder_with_php_code/fileUpload.php



since the GravFolder is the document root. Now that's just the wrong path, hence, the 404.



Now, I could just add my folder_with_php_code under the GravFolder, but Grav doesn't allow php code to run within itself due to security reasons. And I don't have the time to try and go through hoops and loops just to make it work.



What I've tried is to make the html/index.html file redirect to the html/GravFolder/index.php, so that when visitors go to www.MySiteHere.com, it goes to the www.MySiteHere.com/GravFolder and loads the new site.



The file upload takes precedence over everything, and as much as possible, I want to keep the file upload url as www.MySiteHere.com/GravFolder/folder_with_php_code/fileUpload.php. But at the same time, I want www.MySiteHere.com to point to the GravFolder.



Is there any way that I can achieve what I want?



Any lead would be appreciated.










share|improve this question



























    0















    I have a server running Ubuntu 14.04 and a LAMP Stack. It's working, I am able to upload my javascript and php script to the html folder and I'm able to see my web site if I go to www.MySiteHere.com and the various folders under it.



    I've recently made a new site using Grav. I have installed Grav in my server, and I've uploaded our new site. I want the new site to load automatically once our site is visited, and the way I did this was to change the document root to:



    /var/www/html/GravFolder/


    In this way, whenever I loaded www.MySiteHere.com, the new Grav site loads. This solution works.



    However, the problem now is this: Since I moved the document root to the Grav Folder, I am now unable to access the other folders in the html folder, some of which contain php code that are important to our operations.



    Let me illustrate the folder structure:



    /var/root/html
    |--> index.html <-- old index file
    |--> GravFolder
    |--> index.php <-- new index file
    |--> folder_with_php_code
    |--> fileUpload.php <-- impt php file


    If the Document Root points to just the /html folder, I have no problems with the fileUpload.php file. I can go to www.MySiteHere/folder_with_php_code/fileUpload.php and I'll see my php upload page. But the Grav page would be accessible through www.MySiteHere.com/GravFolder, instead of www.MySiteHere.com



    But since I want the new Grav site to be my new index, I point the Document Root to /html/GravFolder. This makes www.MySiteHere.com load the Grav Site I made, but in turn, when I try to go to www.MySiteHere/folder_with_php_code/fileUpload.php, it gives me a 404, because the server interprets the url as:



    www.MySiteHere/GravFolder/folder_with_php_code/fileUpload.php



    since the GravFolder is the document root. Now that's just the wrong path, hence, the 404.



    Now, I could just add my folder_with_php_code under the GravFolder, but Grav doesn't allow php code to run within itself due to security reasons. And I don't have the time to try and go through hoops and loops just to make it work.



    What I've tried is to make the html/index.html file redirect to the html/GravFolder/index.php, so that when visitors go to www.MySiteHere.com, it goes to the www.MySiteHere.com/GravFolder and loads the new site.



    The file upload takes precedence over everything, and as much as possible, I want to keep the file upload url as www.MySiteHere.com/GravFolder/folder_with_php_code/fileUpload.php. But at the same time, I want www.MySiteHere.com to point to the GravFolder.



    Is there any way that I can achieve what I want?



    Any lead would be appreciated.










    share|improve this question

























      0












      0








      0








      I have a server running Ubuntu 14.04 and a LAMP Stack. It's working, I am able to upload my javascript and php script to the html folder and I'm able to see my web site if I go to www.MySiteHere.com and the various folders under it.



      I've recently made a new site using Grav. I have installed Grav in my server, and I've uploaded our new site. I want the new site to load automatically once our site is visited, and the way I did this was to change the document root to:



      /var/www/html/GravFolder/


      In this way, whenever I loaded www.MySiteHere.com, the new Grav site loads. This solution works.



      However, the problem now is this: Since I moved the document root to the Grav Folder, I am now unable to access the other folders in the html folder, some of which contain php code that are important to our operations.



      Let me illustrate the folder structure:



      /var/root/html
      |--> index.html <-- old index file
      |--> GravFolder
      |--> index.php <-- new index file
      |--> folder_with_php_code
      |--> fileUpload.php <-- impt php file


      If the Document Root points to just the /html folder, I have no problems with the fileUpload.php file. I can go to www.MySiteHere/folder_with_php_code/fileUpload.php and I'll see my php upload page. But the Grav page would be accessible through www.MySiteHere.com/GravFolder, instead of www.MySiteHere.com



      But since I want the new Grav site to be my new index, I point the Document Root to /html/GravFolder. This makes www.MySiteHere.com load the Grav Site I made, but in turn, when I try to go to www.MySiteHere/folder_with_php_code/fileUpload.php, it gives me a 404, because the server interprets the url as:



      www.MySiteHere/GravFolder/folder_with_php_code/fileUpload.php



      since the GravFolder is the document root. Now that's just the wrong path, hence, the 404.



      Now, I could just add my folder_with_php_code under the GravFolder, but Grav doesn't allow php code to run within itself due to security reasons. And I don't have the time to try and go through hoops and loops just to make it work.



      What I've tried is to make the html/index.html file redirect to the html/GravFolder/index.php, so that when visitors go to www.MySiteHere.com, it goes to the www.MySiteHere.com/GravFolder and loads the new site.



      The file upload takes precedence over everything, and as much as possible, I want to keep the file upload url as www.MySiteHere.com/GravFolder/folder_with_php_code/fileUpload.php. But at the same time, I want www.MySiteHere.com to point to the GravFolder.



      Is there any way that I can achieve what I want?



      Any lead would be appreciated.










      share|improve this question














      I have a server running Ubuntu 14.04 and a LAMP Stack. It's working, I am able to upload my javascript and php script to the html folder and I'm able to see my web site if I go to www.MySiteHere.com and the various folders under it.



      I've recently made a new site using Grav. I have installed Grav in my server, and I've uploaded our new site. I want the new site to load automatically once our site is visited, and the way I did this was to change the document root to:



      /var/www/html/GravFolder/


      In this way, whenever I loaded www.MySiteHere.com, the new Grav site loads. This solution works.



      However, the problem now is this: Since I moved the document root to the Grav Folder, I am now unable to access the other folders in the html folder, some of which contain php code that are important to our operations.



      Let me illustrate the folder structure:



      /var/root/html
      |--> index.html <-- old index file
      |--> GravFolder
      |--> index.php <-- new index file
      |--> folder_with_php_code
      |--> fileUpload.php <-- impt php file


      If the Document Root points to just the /html folder, I have no problems with the fileUpload.php file. I can go to www.MySiteHere/folder_with_php_code/fileUpload.php and I'll see my php upload page. But the Grav page would be accessible through www.MySiteHere.com/GravFolder, instead of www.MySiteHere.com



      But since I want the new Grav site to be my new index, I point the Document Root to /html/GravFolder. This makes www.MySiteHere.com load the Grav Site I made, but in turn, when I try to go to www.MySiteHere/folder_with_php_code/fileUpload.php, it gives me a 404, because the server interprets the url as:



      www.MySiteHere/GravFolder/folder_with_php_code/fileUpload.php



      since the GravFolder is the document root. Now that's just the wrong path, hence, the 404.



      Now, I could just add my folder_with_php_code under the GravFolder, but Grav doesn't allow php code to run within itself due to security reasons. And I don't have the time to try and go through hoops and loops just to make it work.



      What I've tried is to make the html/index.html file redirect to the html/GravFolder/index.php, so that when visitors go to www.MySiteHere.com, it goes to the www.MySiteHere.com/GravFolder and loads the new site.



      The file upload takes precedence over everything, and as much as possible, I want to keep the file upload url as www.MySiteHere.com/GravFolder/folder_with_php_code/fileUpload.php. But at the same time, I want www.MySiteHere.com to point to the GravFolder.



      Is there any way that I can achieve what I want?



      Any lead would be appreciated.







      14.04 server apache2 php lamp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 13 mins ago









      RazgrizRazgriz

      1034




      1034






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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%2faskubuntu.com%2fquestions%2f1122127%2fubuntu-14-04-maintaining-old-file-paths-after-moving-document-root%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f1122127%2fubuntu-14-04-maintaining-old-file-paths-after-moving-document-root%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

          GameSpot

          connect to host localhost port 22: Connection refused

          Getting a Wifi WPA2 wifi connection