How do I redirect my github URL to the index file located within a folder?












2















The location at which my site ACTUALLY works: https://username.github.io/html/



The location at which I want my site to ACTUALLY work: http://username.github.io



Initially, I had my index.html directly in my repository, but then I moved it into an html folder with all my other html files for organization. How do I make it so it works in the following manner:



<head>
<title> NAME </title>
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
<link rel="stylesheet" href="../css/index.css">
</head>

<section id="Site">
<h3>
<a href="../html/">FIRST LAST </a>
</h3>
</section>


The location at which I want my site to ACTUALLY work: http://username.github.io



Thanks










share|improve this question























  • You don't. You don't get access to vanity urls in that way on Github - set up a dedicated branch for your web content, with your index.html at the top level and all your assets organized normally, and then tell github to use that branch as gh-pages branch.

    – Mike 'Pomax' Kamermans
    Jan 1 at 7:25
















2















The location at which my site ACTUALLY works: https://username.github.io/html/



The location at which I want my site to ACTUALLY work: http://username.github.io



Initially, I had my index.html directly in my repository, but then I moved it into an html folder with all my other html files for organization. How do I make it so it works in the following manner:



<head>
<title> NAME </title>
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
<link rel="stylesheet" href="../css/index.css">
</head>

<section id="Site">
<h3>
<a href="../html/">FIRST LAST </a>
</h3>
</section>


The location at which I want my site to ACTUALLY work: http://username.github.io



Thanks










share|improve this question























  • You don't. You don't get access to vanity urls in that way on Github - set up a dedicated branch for your web content, with your index.html at the top level and all your assets organized normally, and then tell github to use that branch as gh-pages branch.

    – Mike 'Pomax' Kamermans
    Jan 1 at 7:25














2












2








2








The location at which my site ACTUALLY works: https://username.github.io/html/



The location at which I want my site to ACTUALLY work: http://username.github.io



Initially, I had my index.html directly in my repository, but then I moved it into an html folder with all my other html files for organization. How do I make it so it works in the following manner:



<head>
<title> NAME </title>
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
<link rel="stylesheet" href="../css/index.css">
</head>

<section id="Site">
<h3>
<a href="../html/">FIRST LAST </a>
</h3>
</section>


The location at which I want my site to ACTUALLY work: http://username.github.io



Thanks










share|improve this question














The location at which my site ACTUALLY works: https://username.github.io/html/



The location at which I want my site to ACTUALLY work: http://username.github.io



Initially, I had my index.html directly in my repository, but then I moved it into an html folder with all my other html files for organization. How do I make it so it works in the following manner:



<head>
<title> NAME </title>
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
<link rel="stylesheet" href="../css/index.css">
</head>

<section id="Site">
<h3>
<a href="../html/">FIRST LAST </a>
</h3>
</section>


The location at which I want my site to ACTUALLY work: http://username.github.io



Thanks







javascript html css git github






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 1 at 7:08









GryfphenGryfphen

134




134













  • You don't. You don't get access to vanity urls in that way on Github - set up a dedicated branch for your web content, with your index.html at the top level and all your assets organized normally, and then tell github to use that branch as gh-pages branch.

    – Mike 'Pomax' Kamermans
    Jan 1 at 7:25



















  • You don't. You don't get access to vanity urls in that way on Github - set up a dedicated branch for your web content, with your index.html at the top level and all your assets organized normally, and then tell github to use that branch as gh-pages branch.

    – Mike 'Pomax' Kamermans
    Jan 1 at 7:25

















You don't. You don't get access to vanity urls in that way on Github - set up a dedicated branch for your web content, with your index.html at the top level and all your assets organized normally, and then tell github to use that branch as gh-pages branch.

– Mike 'Pomax' Kamermans
Jan 1 at 7:25





You don't. You don't get access to vanity urls in that way on Github - set up a dedicated branch for your web content, with your index.html at the top level and all your assets organized normally, and then tell github to use that branch as gh-pages branch.

– Mike 'Pomax' Kamermans
Jan 1 at 7:25












2 Answers
2






active

oldest

votes


















0














Apparently, as you can read on github pages doc, you cannot configure it for having the "main page" on another place who aren't the root of repository, or a folder called docs.



As a workaround, you can try some options:




  1. You can try to use an .htaccess document, for configuring a 301 redirect. I didn't know if this can work on github pages, because I haven't use these service.


  2. You can try to put an index.htm on the root of the repository, and do a redirect from it. Check this code:



    <meta http-equiv="refresh" content="0; url=http://example.com/" />




If you need more information about how to do a redirect on html, check this question on SO: Redirect from an HTML page. But think, the redirect will only work for each file you create (for example, index.htm). And they only can have one destination. This option will not allow you to redirect any request to the page to the /html/ folder.






share|improve this answer
























  • htaccess will do nothing, gh-pages don't run on Apache.

    – Mike 'Pomax' Kamermans
    Jan 1 at 7:26











  • I found method #2 to work. I created an index.html and redirected it to the main one within the folder. Although it doesn't look as nice as I'd like, it'll work for now. Thanks dude!

    – Gryfphen
    Jan 1 at 7:30



















0














You need to use the relative path to your index.html. So you'd have






<a href="../html/index.html">FIRST LAST</a>








share|improve this answer























    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%2f53993678%2fhow-do-i-redirect-my-github-url-to-the-index-file-located-within-a-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














    Apparently, as you can read on github pages doc, you cannot configure it for having the "main page" on another place who aren't the root of repository, or a folder called docs.



    As a workaround, you can try some options:




    1. You can try to use an .htaccess document, for configuring a 301 redirect. I didn't know if this can work on github pages, because I haven't use these service.


    2. You can try to put an index.htm on the root of the repository, and do a redirect from it. Check this code:



      <meta http-equiv="refresh" content="0; url=http://example.com/" />




    If you need more information about how to do a redirect on html, check this question on SO: Redirect from an HTML page. But think, the redirect will only work for each file you create (for example, index.htm). And they only can have one destination. This option will not allow you to redirect any request to the page to the /html/ folder.






    share|improve this answer
























    • htaccess will do nothing, gh-pages don't run on Apache.

      – Mike 'Pomax' Kamermans
      Jan 1 at 7:26











    • I found method #2 to work. I created an index.html and redirected it to the main one within the folder. Although it doesn't look as nice as I'd like, it'll work for now. Thanks dude!

      – Gryfphen
      Jan 1 at 7:30
















    0














    Apparently, as you can read on github pages doc, you cannot configure it for having the "main page" on another place who aren't the root of repository, or a folder called docs.



    As a workaround, you can try some options:




    1. You can try to use an .htaccess document, for configuring a 301 redirect. I didn't know if this can work on github pages, because I haven't use these service.


    2. You can try to put an index.htm on the root of the repository, and do a redirect from it. Check this code:



      <meta http-equiv="refresh" content="0; url=http://example.com/" />




    If you need more information about how to do a redirect on html, check this question on SO: Redirect from an HTML page. But think, the redirect will only work for each file you create (for example, index.htm). And they only can have one destination. This option will not allow you to redirect any request to the page to the /html/ folder.






    share|improve this answer
























    • htaccess will do nothing, gh-pages don't run on Apache.

      – Mike 'Pomax' Kamermans
      Jan 1 at 7:26











    • I found method #2 to work. I created an index.html and redirected it to the main one within the folder. Although it doesn't look as nice as I'd like, it'll work for now. Thanks dude!

      – Gryfphen
      Jan 1 at 7:30














    0












    0








    0







    Apparently, as you can read on github pages doc, you cannot configure it for having the "main page" on another place who aren't the root of repository, or a folder called docs.



    As a workaround, you can try some options:




    1. You can try to use an .htaccess document, for configuring a 301 redirect. I didn't know if this can work on github pages, because I haven't use these service.


    2. You can try to put an index.htm on the root of the repository, and do a redirect from it. Check this code:



      <meta http-equiv="refresh" content="0; url=http://example.com/" />




    If you need more information about how to do a redirect on html, check this question on SO: Redirect from an HTML page. But think, the redirect will only work for each file you create (for example, index.htm). And they only can have one destination. This option will not allow you to redirect any request to the page to the /html/ folder.






    share|improve this answer













    Apparently, as you can read on github pages doc, you cannot configure it for having the "main page" on another place who aren't the root of repository, or a folder called docs.



    As a workaround, you can try some options:




    1. You can try to use an .htaccess document, for configuring a 301 redirect. I didn't know if this can work on github pages, because I haven't use these service.


    2. You can try to put an index.htm on the root of the repository, and do a redirect from it. Check this code:



      <meta http-equiv="refresh" content="0; url=http://example.com/" />




    If you need more information about how to do a redirect on html, check this question on SO: Redirect from an HTML page. But think, the redirect will only work for each file you create (for example, index.htm). And they only can have one destination. This option will not allow you to redirect any request to the page to the /html/ folder.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 1 at 7:23









    Sakura KinomotoSakura Kinomoto

    1,0111122




    1,0111122













    • htaccess will do nothing, gh-pages don't run on Apache.

      – Mike 'Pomax' Kamermans
      Jan 1 at 7:26











    • I found method #2 to work. I created an index.html and redirected it to the main one within the folder. Although it doesn't look as nice as I'd like, it'll work for now. Thanks dude!

      – Gryfphen
      Jan 1 at 7:30



















    • htaccess will do nothing, gh-pages don't run on Apache.

      – Mike 'Pomax' Kamermans
      Jan 1 at 7:26











    • I found method #2 to work. I created an index.html and redirected it to the main one within the folder. Although it doesn't look as nice as I'd like, it'll work for now. Thanks dude!

      – Gryfphen
      Jan 1 at 7:30

















    htaccess will do nothing, gh-pages don't run on Apache.

    – Mike 'Pomax' Kamermans
    Jan 1 at 7:26





    htaccess will do nothing, gh-pages don't run on Apache.

    – Mike 'Pomax' Kamermans
    Jan 1 at 7:26













    I found method #2 to work. I created an index.html and redirected it to the main one within the folder. Although it doesn't look as nice as I'd like, it'll work for now. Thanks dude!

    – Gryfphen
    Jan 1 at 7:30





    I found method #2 to work. I created an index.html and redirected it to the main one within the folder. Although it doesn't look as nice as I'd like, it'll work for now. Thanks dude!

    – Gryfphen
    Jan 1 at 7:30













    0














    You need to use the relative path to your index.html. So you'd have






    <a href="../html/index.html">FIRST LAST</a>








    share|improve this answer




























      0














      You need to use the relative path to your index.html. So you'd have






      <a href="../html/index.html">FIRST LAST</a>








      share|improve this answer


























        0












        0








        0







        You need to use the relative path to your index.html. So you'd have






        <a href="../html/index.html">FIRST LAST</a>








        share|improve this answer













        You need to use the relative path to your index.html. So you'd have






        <a href="../html/index.html">FIRST LAST</a>








        <a href="../html/index.html">FIRST LAST</a>





        <a href="../html/index.html">FIRST LAST</a>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 1 at 7:21









        ibn_Abubakreibn_Abubakre

        775




        775






























            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%2f53993678%2fhow-do-i-redirect-my-github-url-to-the-index-file-located-within-a-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

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas