SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Should Local Host end with slash "/"

    Someone I know is telling me that Apache will automatically appends a forward slash on to the end of either my domain name or Local Host.

    But what confuses me is that in my Virtual Host file on my macBook, I have this for the Local Host...


    My Macintosh HD: private: etc: hosts as follows..
    Code:
    127.0.0.1 local.one
    127.0.0.1 local.debbie

    And my Applications: MAMP: conf: apache: httpd.conf as follows...
    Code:
    # Uncommented the line below on 2011-08-13
    NameVirtualHost *
    
    # Added on 2011-08-13
    <VirtualHost *:80>
    # DocumentRoot /Applications/MAMP/htdocs
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs"
    ServerName localhost
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs/00_AAA"
    ServerName local.one
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs/06_Debbie"
    ServerName local.debbie
    </VirtualHost>

    In essence, what I hear this person saying is that I should have something like this instead...

    127.0.0.1 local.one/
    127.0.0.1 local.debbie/

    What I do know is this...

    I normally expect a domain to look like this...

    www.MySite.com


    ...and even the Local Host in my browser during testing should probably be...

    local.debbie

    ...since that is really my "Home Page" locally - and not some empty directory, which is how I would read as local.debbie/


    Comments?

    Thanks,


    Debbie

  2. #2
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    357
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do not put directory slashes in hosts files. DNS has no concept of directories.
    Doug G
    =====
    "If you ain't the lead dog, the view is always the same - Anon

  3. #3
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,129
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    Someone I know is telling me that Apache will automatically appends a forward slash on to the end of either my domain name or Local Host.

    But what confuses me is that in my Virtual Host file on my macBook, I have this for the Local Host...


    My Macintosh HD: private: etc: hosts as follows..
    Code:
    127.0.0.1 local.one
    127.0.0.1 local.debbie

    And my Applications: MAMP: conf: apache: httpd.conf as follows...
    Code:
    # Uncommented the line below on 2011-08-13
    NameVirtualHost *
    
    # Added on 2011-08-13
    <VirtualHost *:80>
    # DocumentRoot /Applications/MAMP/htdocs
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs"
    ServerName localhost
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs/00_AAA"
    ServerName local.one
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs/06_Debbie"
    ServerName local.debbie
    </VirtualHost>

    In essence, what I hear this person saying is that I should have something like this instead...




    What I do know is this...

    I normally expect a domain to look like this...

    www.MySite.com


    ...and even the Local Host in my browser during testing should probably be...

    local.debbie

    ...since that is really my "Home Page" locally - and not some empty directory, which is how I would read as local.debbie/


    Comments?

    Thanks,


    Debbie
    No No No. My point was, when you visit http://local.debbie, apache is requesting http://local.debbie/ asking for the root web folder (the /) that is defined in your virtual host. It then looks for the default file names you allow (index.html, index.php, etc). Once it finds it, it serves it up, otherwise, it checks if your directory is browseable, and will serve up a directory listing if it is, otherwise you get a 404 or server not found error.

    Specifically you were asking about your RewriteRule and your BASE_URL variable in your PHP script.
    My point to you was you were confusing your BASE_URL variable in PHP with what Apache see's as your base web folder, which is local.debbie/. I've tried showing this in logs showing that your RewriteRule doesn't care about the forward slash at the base of your web folder, it only cares about what is after that slash.

    Oh well...

  4. #4
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    No No No. My point was, when you visit http://local.debbie, apache is requesting http://local.debbie/ asking for the root web folder (the /) that is defined in your virtual host.

    And where is it doing that in the code I posted above?

    It can't be doing it here...

    My Macintosh HD: private: etc: hosts as follows..

    Code:
    127.0.0.1 local.one
    127.0.0.1 local.debbie
    BTW, what exactly am I defining there? (I thought I was defining what my Local Host is there, in other words, what address I have to type into the browser so that MAMP serves up my default web page in my Web Root?)


    And I'm not sure where it would exist in this code either...

    And my Applications: MAMP: conf: apache: httpd.conf as follows...

    Code:
    # Uncommented the line below on 2011-08-13
    NameVirtualHost *
    
    # Added on 2011-08-13
    <VirtualHost *:80>
    # DocumentRoot /Applications/MAMP/htdocs
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs"
    ServerName localhost
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs/00_AAA"
    ServerName local.one
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "/Users/user1/Documents/DEV/++htdocs/06_Debbie"
    ServerName local.debbie
    </VirtualHost>
    Again, I am not seeing the mapping of the URL local.debbie to my Web Root, which you are claiming is local.debbie/

    I guess I am not understanding what you are saying?!



    [quote]It then looks for the default file names you allow (index.html, index.php, etc). Once it finds it, it serves it up, otherwise, it checks if your directory is browseable, and will serve up a directory listing if it is, otherwise you get a 404 or server not found error.

    Specifically you were asking about your RewriteRule and your BASE_URL variable in your PHP script.
    My point to you was you were confusing your BASE_URL variable in PHP with what Apache see's as your base web folder, which is local.debbie/. [quote]

    I follow you on what you are saying about my PHP Constant called BASE_URL.

    But what I still do not see is where I have mapped the URL local.debbie to my Web Root, local.debbie/

    Or are you saying that I do NOT have to do that, because Apache assumes that?!

    Actually looking above, what I *think* my code is saying this...

    Define the URL/Local Host as local.debbie

    This is the URL from which everything eminates, just like from a URL on the web like www.MySite.com

    Now link local.debbie to the physical Web Root folder in NetBeans called '/Users/user1/Documents/DEV/++htdocs/06_Debbie'

    If nothing is specified in the Browser's Address Bar after "local.debbie", then go look for an "index.html" or "index.php" file and serve that up, but still just display local.debbie

    If the URL is something like this...

    'local.debbie/usa/arizona/about-phoenix.php'

    ...then go to the physical Web Root defined above, and look for the file 'about-phoenix.php' in the sub-folder called 'arizona' in the main folder called 'usa'

    Quote Originally Posted by cpradio
    I've tried showing this in logs showing that your RewriteRule doesn't care about the forward slash at the base of your web folder, it only cares about what is after that slash.

    Oh well...
    I'm sorry.

    This is all new to me and what others have taught me in the past, and I am trying my best...


    Debbie


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
  •