WordPress.org

Ready to get started?Download WordPress

Forums

404 when visiting my localhost WP network from other devices on my LAN (7 posts)

  1. robertwbradford
    Member
    Posted 1 year ago #

    I have a local WP network running fine on my iMac (OS X 10.8.3). However, when I visit any of these WP sites from another device (e.g., iPad or iPhone) connected to the same wireless network, I get 404s.

    From these devices I can view other folders in my iMac's "Sites" directory. It's just when I go to the "wp" directory where my WP network is running.

    I wonder if it has something to do with the permissions? I had used the following to modify permissions for downloading and installing plugins, etc.:

    $ cd Sites
    $ sudo chown -R _www wp
    $ sudo chmod -R g+w wp

    Not sure if this would affect things. Anyone else had the same problem, or know what I can do to make this WP network available to other devices on my wireless network?

    Thanks.

  2. andrewmills
    Member
    Posted 1 year ago #

    I'm guessing it's more likely to do with the values you've entered for Site URL and WordPress URL. Mind if I ask what you entered for those?

  3. gabrielcastillo
    Member
    Posted 1 year ago #

    Might be a server issue. What are you running your apache and php on? When you are using on local computer, your host file is pointing directly to your local machine.. maybe you need to assign you local site with a ip address so other devices can point to the right directory.

  4. robertwbradford
    Member
    Posted 1 year ago #

    Thanks for the replies. I've verified that the URLs are correct. I'm on an iMac running OS X 10.8.3. WordPress is located at /Users/robs/Sites/wp/ and is available locally at http://localhost/~robs/wp. This works correctly. From an iPad on the same wireless network I can access my iMac's web server here:

    http://imac.local/~robs/

    This gives me the apache index. However, when I then go to http://imac.local/~robs/wp, I get the 404.

    Still not sure how to fix it...

  5. ClaytonJames
    Member
    Posted 1 year ago #

    It might be due to the "//localhost" portion of the WordPress URL's in your general settings. That usually makes it pretty much inaccessible from any other machine.

  6. robertwbradford
    Member
    Posted 1 year ago #

    Thanks, @ClaytonJames. That was it. I now remember having this problem a long time ago, in WP network far, far away. You either have to go in and make a bunch of edits to db records changing out "localhost" for "imac.local" (or whatever your computer is named), or you start over with a fresh database and WP setup by going to http://your-computer-name.local/~username/wordpress-directory/ instead of http://localhost/~username/wordpress-directory/

    Fortunately for me, this was a brand new WP install, so I just started over.

    So, the moral of the story: If you are developing locally on OS X and would like to access your sites from other devices on your LAN, start out your WordPress install by using http://your-computer-name.local/~username/wordpress-directory/ instead of http://localhost/~username/wordpress-directory/

    Hope this helps others.

  7. gabrielcastillo
    Member
    Posted 1 year ago #

    One thing you can do is virtual host. I do this on my windows machine but you can change the DocumentRoot and Directory path on your mac and have the same setup.

    With this setup I can goto http://wordpress.dev and get to my site.

    This would go at the bottom of you http.config file.

    ######################################
    NameVirtualHost 127.0.0.1
    <VirtualHost 127.0.0.1>
    ServerName localhost
    DocumentRoot "C:/wamp/www" 
    
    <Directory "c:/wamp/www">
    allow from all
    order allow,deny
    # Enables .htaccess files for this site
    AllowOverride All
     </Directory>
    </VirtualHost>
    ####################################
    NameVirtualHost 127.0.0.1
    <VirtualHost 127.0.0.1>
    ServerName wordpress.dev
    DocumentRoot "C:/www/wordpress"
    
    <Directory "C:/www/wordpress">
    allow from all
    order allow,deny
    # Enables .htaccess files for this site
    AllowOverride All
    </Directory>
    </VirtualHost>
    ######################################

Topic Closed

This topic has been closed to new replies.

About this Topic