Setup vhost for subdomain











up vote
1
down vote

favorite












I am trying to make vhost, but it is kinda semi working. I am able to run the index.php and load home page, but when I try to go to any link I am getting:



Not Found

The requested URL /home was not found on this server.
Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80


(I am using yii2 framework, if that means something). I also can access the site using subdomain (I am getting Server not found). What is the proper configuration?
I am using Linux Mint 17.1 with default LAMP settings. This is my c2s.conf:



<VirtualHost 127.0.1.1:80>
DocumentRoot /var/www/c2c/www
ServerName c2s.dev
ServerAlias *.c2s.dev
</VirtualHost>


And in /etc/hosts I added this:



127.0.1.1   c2s.dev
127.0.1.1 *.c2s.dev









share|improve this question




























    up vote
    1
    down vote

    favorite












    I am trying to make vhost, but it is kinda semi working. I am able to run the index.php and load home page, but when I try to go to any link I am getting:



    Not Found

    The requested URL /home was not found on this server.
    Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80


    (I am using yii2 framework, if that means something). I also can access the site using subdomain (I am getting Server not found). What is the proper configuration?
    I am using Linux Mint 17.1 with default LAMP settings. This is my c2s.conf:



    <VirtualHost 127.0.1.1:80>
    DocumentRoot /var/www/c2c/www
    ServerName c2s.dev
    ServerAlias *.c2s.dev
    </VirtualHost>


    And in /etc/hosts I added this:



    127.0.1.1   c2s.dev
    127.0.1.1 *.c2s.dev









    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am trying to make vhost, but it is kinda semi working. I am able to run the index.php and load home page, but when I try to go to any link I am getting:



      Not Found

      The requested URL /home was not found on this server.
      Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80


      (I am using yii2 framework, if that means something). I also can access the site using subdomain (I am getting Server not found). What is the proper configuration?
      I am using Linux Mint 17.1 with default LAMP settings. This is my c2s.conf:



      <VirtualHost 127.0.1.1:80>
      DocumentRoot /var/www/c2c/www
      ServerName c2s.dev
      ServerAlias *.c2s.dev
      </VirtualHost>


      And in /etc/hosts I added this:



      127.0.1.1   c2s.dev
      127.0.1.1 *.c2s.dev









      share|improve this question















      I am trying to make vhost, but it is kinda semi working. I am able to run the index.php and load home page, but when I try to go to any link I am getting:



      Not Found

      The requested URL /home was not found on this server.
      Apache/2.4.7 (Ubuntu) Server at c2s.dev Port 80


      (I am using yii2 framework, if that means something). I also can access the site using subdomain (I am getting Server not found). What is the proper configuration?
      I am using Linux Mint 17.1 with default LAMP settings. This is my c2s.conf:



      <VirtualHost 127.0.1.1:80>
      DocumentRoot /var/www/c2c/www
      ServerName c2s.dev
      ServerAlias *.c2s.dev
      </VirtualHost>


      And in /etc/hosts I added this:



      127.0.1.1   c2s.dev
      127.0.1.1 *.c2s.dev






      php apache-httpd vhost






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 at 22:49









      Rui F Ribeiro

      38.3k1477127




      38.3k1477127










      asked Mar 2 '16 at 12:50









      Sasha

      11315




      11315






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          The official site of Yii explains how to configure vhost for apache. You can see the examples here



          For apache basically the configuration is:



          <Directory "path/to/basic/web">
          # use mod_rewrite for pretty URL support
          RewriteEngine on
          # If a directory or a file exists, use the request directly
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          # Otherwise forward the request to index.php
          RewriteRule . index.php

          # ...other settings...
          </Directory>


          For you case it could look like this:



          <VirtualHost *:80>
          ServerName c2s.dev
          DocumentRoot /var/www/c2c/www
          <Directory /var/www/c2c/www>
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Order allow,deny
          allow from all
          </Directory>
          </VirtualHost>


          And the file .htaccess on the root web folder like this:
          Options +FollowSymLinks
          IndexIgnore /



          <IfModule mod_rewrite.c>
          RewriteEngine on

          #RewriteBase /

          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d

          RewriteRule ^.*$ index.php
          </IfModule>





          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            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',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2funix.stackexchange.com%2fquestions%2f267060%2fsetup-vhost-for-subdomain%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            The official site of Yii explains how to configure vhost for apache. You can see the examples here



            For apache basically the configuration is:



            <Directory "path/to/basic/web">
            # use mod_rewrite for pretty URL support
            RewriteEngine on
            # If a directory or a file exists, use the request directly
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            # Otherwise forward the request to index.php
            RewriteRule . index.php

            # ...other settings...
            </Directory>


            For you case it could look like this:



            <VirtualHost *:80>
            ServerName c2s.dev
            DocumentRoot /var/www/c2c/www
            <Directory /var/www/c2c/www>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
            </Directory>
            </VirtualHost>


            And the file .htaccess on the root web folder like this:
            Options +FollowSymLinks
            IndexIgnore /



            <IfModule mod_rewrite.c>
            RewriteEngine on

            #RewriteBase /

            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d

            RewriteRule ^.*$ index.php
            </IfModule>





            share|improve this answer

























              up vote
              0
              down vote













              The official site of Yii explains how to configure vhost for apache. You can see the examples here



              For apache basically the configuration is:



              <Directory "path/to/basic/web">
              # use mod_rewrite for pretty URL support
              RewriteEngine on
              # If a directory or a file exists, use the request directly
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME} !-d
              # Otherwise forward the request to index.php
              RewriteRule . index.php

              # ...other settings...
              </Directory>


              For you case it could look like this:



              <VirtualHost *:80>
              ServerName c2s.dev
              DocumentRoot /var/www/c2c/www
              <Directory /var/www/c2c/www>
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Order allow,deny
              allow from all
              </Directory>
              </VirtualHost>


              And the file .htaccess on the root web folder like this:
              Options +FollowSymLinks
              IndexIgnore /



              <IfModule mod_rewrite.c>
              RewriteEngine on

              #RewriteBase /

              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME} !-d

              RewriteRule ^.*$ index.php
              </IfModule>





              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                The official site of Yii explains how to configure vhost for apache. You can see the examples here



                For apache basically the configuration is:



                <Directory "path/to/basic/web">
                # use mod_rewrite for pretty URL support
                RewriteEngine on
                # If a directory or a file exists, use the request directly
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                # Otherwise forward the request to index.php
                RewriteRule . index.php

                # ...other settings...
                </Directory>


                For you case it could look like this:



                <VirtualHost *:80>
                ServerName c2s.dev
                DocumentRoot /var/www/c2c/www
                <Directory /var/www/c2c/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                </Directory>
                </VirtualHost>


                And the file .htaccess on the root web folder like this:
                Options +FollowSymLinks
                IndexIgnore /



                <IfModule mod_rewrite.c>
                RewriteEngine on

                #RewriteBase /

                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d

                RewriteRule ^.*$ index.php
                </IfModule>





                share|improve this answer












                The official site of Yii explains how to configure vhost for apache. You can see the examples here



                For apache basically the configuration is:



                <Directory "path/to/basic/web">
                # use mod_rewrite for pretty URL support
                RewriteEngine on
                # If a directory or a file exists, use the request directly
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                # Otherwise forward the request to index.php
                RewriteRule . index.php

                # ...other settings...
                </Directory>


                For you case it could look like this:



                <VirtualHost *:80>
                ServerName c2s.dev
                DocumentRoot /var/www/c2c/www
                <Directory /var/www/c2c/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                </Directory>
                </VirtualHost>


                And the file .htaccess on the root web folder like this:
                Options +FollowSymLinks
                IndexIgnore /



                <IfModule mod_rewrite.c>
                RewriteEngine on

                #RewriteBase /

                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d

                RewriteRule ^.*$ index.php
                </IfModule>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 30 '17 at 22:30









                Ale

                1012




                1012






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • 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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2funix.stackexchange.com%2fquestions%2f267060%2fsetup-vhost-for-subdomain%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

                    Morgemoulin

                    Scott Moir

                    Souastre