SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Accessing Same Website Locally and Non-locally?

    Hi,

    I'm not sure where to post this. Anyway, I'm working on a website locally using Xampp and I need to access the non-local site at the same time. The non-local site has a dedicated IP.

    Is there any way to open the non-local site (so I can copy and paste) while still viewing the local site?

    I thought about accessing it with the IP but it resolves to the domain name.

    Thanks

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,871
    Mentioned
    206 Post(s)
    Tagged
    12 Thread(s)
    Hi there,

    I'm not sure I understand your problem.
    When developping locally on xampp, you can access your site relative to the htdocs folder.
    That is to say, if your site is located in C:/xampp/htdocs/mysite/, you can access it at http://localhost/mysite/
    This should have nothing to do with your remote site which will be available at www.mysite.com (or similar).

    Or did I miss something?

  3. #3
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's okay

    I was wanting to view both at the same time. But I think I'm getting the hang of importing/exporting database tables so it might work out.

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,871
    Mentioned
    206 Post(s)
    Tagged
    12 Thread(s)
    Oh, so you want your local site and your remote site to pull in content from the same database?

  5. #5
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No

    I would like to login to my website administration on my hosted account i.e. my website eCommerce "Magento" administration, also login to my local Magento administration. So I can copy and paste administration configuration settings. Then I'm going to delete the old website and re upload the new one.

    Know what I mean? I don't think it is possible.

  6. #6
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,871
    Mentioned
    206 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    I'm still a little confused as to why this would not be possible.

    Is it a cookie issue, that if you log in to one, you cannot log in to the other in the same browser at the same time?

    If so, just use a second browser.

  7. #7
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No it's not a cookie issue. I have to change my host file to go back between each site. I have to tell my computer to go outside for the site or to look for it on itself. It would be very convenient at times to be able to have both open. Maybe my host file is incorrect but it works well.

  8. #8
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,871
    Mentioned
    206 Post(s)
    Tagged
    12 Thread(s)
    Why would this have anything to do with your hosts file?

    What address are you accessing your site under locally?

    It could also be the case that I am missing something. I have never worked locally with magento.

  9. #9
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I have a website I've been developing locally on my computer with Xampp. I had to configure my host file (see below) so I could. Now I have it hosted on an external server. To work on the real (almost) live site I have to change my host file.

    My host file:

    ## Copyright (c) 1993-2006 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example (this is off):
    #
    # 102.54.94.97 rhino.acme.com # source server
    # 38.25.63.10 x.acme.com # x client host

    #::1 localhost
    #127.0.0.1 localhost mybelovedangels.local
    #127.0.0.1 mybelovedangels
    #127.0.0.1 mybelovedangels.com
    #127.0.0.1 www.mybelovedangels.com

  10. #10
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,871
    Mentioned
    206 Post(s)
    Tagged
    12 Thread(s)
    All that that seems to be doing, is pointing the loopback IP address at an external site.

    What happens if you change your hosts file to:

    Code:
    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    
    # localhost name resolution is handled within DNS itself.
    #	127.0.0.1       localhost
    #	::1             localhost
    Can you then not access your remote site under http://www.mybelovedangels.com and your local site under http://localhost/ ?

  11. #11
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried your configuration and what happens is the url jumps from http://localhost/ to http://www.mybelovedangels.com. The url can't go to localhost it seems. It might be my .htaccess configurations.


    Here's my .htaccess. They are both are exactly the same. Not sure how optimal it is but it works.



    HTML Code:
    ############################################
    ## uncomment these lines for CGI mode
    ## make sure to specify the correct cgi php binary file name
    ## it might be /cgi-bin/php-cgi
    
    #    Action php5-cgi /cgi-bin/php5-cgi
    #    AddHandler php5-cgi .php
    
    ############################################
    ## GoDaddy specific options
    
    #   Options -MultiViews
    
    ## you might also need to add this line to php.ini
    ##     cgi.fix_pathinfo = 1
    ## if it still doesn't work, rename php.ini to php5.ini
    
    ############################################
    ## this line is specific for 1and1 hosting
    
        #AddType x-mapp-php5 .php
        #AddHandler x-mapp-php5 .php
    
    ############################################
    ## default index file
    
        DirectoryIndex index.php
    
    <IfModule mod_php5.c>
    
    ############################################
    ## adjust memory limit
    
    #    php_value memory_limit 64M
        php_value memory_limit 256M
        php_value max_execution_time 18000
    
    ############################################
    ## disable magic quotes for php request vars
    
        php_flag magic_quotes_gpc off
    
    ############################################
    ## disable automatic session start
    ## before autoload was initialized
    
        php_flag session.auto_start off
    
    ############################################
    ## enable resulting html compression
    
        php_flag zlib.output_compression on
    
    ###########################################
    # disable user agent verification to not break multiple image upload
    
        php_flag suhosin.session.cryptua off
    
    ###########################################
    # turn off compatibility with PHP4 when dealing with objects
    
        php_flag zend.ze1_compatibility_mode Off
    
    </IfModule>
    
    <IfModule mod_security.c>
    ###########################################
    # disable POST processing to not break multiple image upload
    
        SecFilterEngine Off
        SecFilterScanPOST Off
    </IfModule>
    
    <IfModule mod_deflate.c>
    
    ############################################
    ## enable apache served files compression
    ## http://developer.yahoo.com/performance/rules.html#gzip
    
        # Insert filter
        SetOutputFilter DEFLATE
    
        # Netscape 4.x has some problems...
        BrowserMatch ^Mozilla/4 gzip-only-text/html
    
        # Netscape 4.06-4.08 have some more problems
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
    
        # MSIE masquerades as Netscape, but it is fine
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        # Don't compress images
        SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    
        # Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary
    
    </IfModule>
    
    <IfModule mod_ssl.c>
    
    ############################################
    ## make HTTPS env vars available for CGI mode
    
        SSLOptions StdEnvVars
    
    </IfModule>
    
    <IfModule mod_rewrite.c>
    
    ############################################
    ## enable rewrites
    
        Options +FollowSymLinks
        RewriteEngine on
    
    ############################################
    ## you can put here your magento root folder
    ## path relative to web root
    
        #RewriteBase /
    
    ############################################
    ## uncomment next line to enable light API calls processing
    
    #    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]
    
    ############################################
    ## rewrite API2 calls to api.php (by now it is REST only)
    
        RewriteRule ^api/rest api.php?type=rest [QSA,L]
    
    ############################################
    ## workaround for HTTP authorization
    ## in CGI environment
    
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
       
    ############################################
    ## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
    
        RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
        RewriteRule .* - [L,R=405]
    
    ############################################
    ## redirect for mobile user agents
    
        #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
        #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
        #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
    
    ############################################
    ## always send 404 on missing files in these folders
    
        RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    
    ############################################
    ## never rewrite for existing files, directories and links
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
    
    ############################################
    ## rewrite everything else to index.php
    
        RewriteRule .* index.php [L]
    
    </IfModule>
    
    
    ############################################
    ## Prevent character encoding issues from server overrides
    ## If you still have problems, use the second line instead
    
        AddDefaultCharset Off
        #AddDefaultCharset UTF-8
    
    <IfModule mod_expires.c>
    
    ############################################
    ## Add default Expires header
    ## http://developer.yahoo.com/performance/rules.html#expires
    
        ExpiresDefault "access plus 1 year"
    
    </IfModule>
    
    ############################################
    ## By default allow all access
    
        Order allow,deny
        Allow from all
    
    ###########################################
    ## Deny access to release notes to prevent disclosure of the installed Magento version
    
        <Files RELEASE_NOTES.txt>
            order allow,deny
            deny from all
        </Files>
    
    ############################################
    ## If running in cluster environment, uncomment this
    ## http://developer.yahoo.com/performance/rules.html#etags
    
        #FileETag none
    #Stop Image Hotlinking
    RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mybelovedangels\.com/ [NC]
    RewriteCond %{HTTP_REFERER} !^$
    #Replace /images/nohotlink.jpg with your "don't hotlink" image url
    #RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
    
    # BEGIN EXPIRES
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault "access plus 10 days"
        ExpiresByType text/css "access plus 1 month"
        ExpiresByType text/plain "access plus 1 month"
        ExpiresByType image/gif "access plus 1 month"
        ExpiresByType image/png "access plus 1 month"
        ExpiresByType image/jpeg "access plus 1 month"
        ExpiresByType application/x-javascript "access plus 1 month"
        ExpiresByType application/javascript "access plus 1 month"
        ExpiresByType application/x-icon "access plus 1 year"
    </IfModule>
    # END EXPIRES
    <FilesMatch ".(js|css)$">
    Header append Cache-Control "public"
    </FilesMatch> 
    <FilesMatch "\.(gif|jpe?g|png)$">
    Header set Cache-Control "public"
    </FilesMatch>
    
    <FilesMatch "\.(gif|jpg|jpeg|png|swf|css|js|html?|xml|txt|ico)$">
    	FileETag none
    </FilesMatch>

  12. #12
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,871
    Mentioned
    206 Post(s)
    Tagged
    12 Thread(s)
    At first glance, I cannot see anything in your .htaccess file that should be directing localhost to your remote domain.

    So, if I was you, I would try two things:
    • Sometimes browsers cache redirects, so double check that your hosts file corresponds to what I posted earlier, then clear all your cookies / browsing data and try again.
    • If that doesn't have any effect, try commenting out your .htaccess file, bit by bit and see if that makes a difference. Make sure you make a back up of the file before messing around with it, though.

    Let me know how you get on.

  13. #13
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried setting my hosts file like you posted with and without the lines commented out. I used a browser i never use much so I can clear everything completely out of it, but the url always jumps. If I turn Xampp off then there is no jumping but only the Safari's (the browser I'm testing with) blank page.

    Maybe it's in one of my php.ini or httpd.conf file? Maybe it can't be done have you ever done this before?

  14. #14
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,871
    Mentioned
    206 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by Freejoy View Post
    I tried setting my hosts file like you posted with and without the lines commented out. I used a browser i never use much so I can clear everything completely out of it, but the url always jumps. If I turn Xampp off then there is no jumping but only the Safari's (the browser I'm testing with) blank page.
    Shame.

    Quote Originally Posted by Freejoy View Post
    Maybe it's in one of my php.ini or httpd.conf file? Maybe it can't be done have you ever done this before?
    I'm sure it can be done and I use xampp quite a lot, but unfortunately I have no direct experience of getting Magento to run locally.

    I've just been having a quick search of Google and I found an article that says Magento doesn't recognize localhost as a domain name, but will work with http://127.0.0.1
    What happens if you keep the hosts file as before, then enter http://127.0.0.1/path/to/magento into your browser?
    Any joy?

    Here's the article I got it from: http://www.terranetwork.net/blog/200...gento-on-a-pc/
    Maybe if you have a look at that, you might notice something we have missed.

  15. #15
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,001
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    Maybe you can assign a specific port number to the localhost site?

  16. #16
    SitePoint Addict
    Join Date
    Mar 2008
    Location
    Sterling, CO
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    haha I put exactly http://127.0.0.1/path/to/magento in the browser it jumps to my site. Long time back when I started this project with Magento I went through much trouble making sure it would be exactly the same locally as live. I remember not wanting it to go to localhost because I thought it might mess up my links when I went live. So I might have done something. Anyway, I'll just have to learn how to import/export database tables better. But man does Magento have a database!

  17. #17
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,871
    Mentioned
    206 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by Freejoy View Post
    haha I put exactly http://127.0.0.1/path/to/magento in the browser it jumps to my site.
    Glad you got it sorted out
    Good luck importing your db.


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
  •