Support » Networking WordPress » VirtualHosts for WordPress Multisite Network – Subdir Alias isn’t working

  • Resolved joeztuerk

    (@joeztuerk)


    Hey there,

    I’m currently in a bit of a mess.
    I set up a WordPress Multisite Network on an Apache 2.4 Webserver and I am trying to manage domain mapping via VirtualHost.
    So far so good, I can reach the homepage of one of my sites (localhost/wordpress/example is now http://www.example.com) just fine but as soon as I try to get to a subsite on my site (localhost/wordpress/example/subsite -> http://www.example.com/subsite) I get “403 – Forbidden – you don’t have permission to access /subsite on this server”

    I will show you what I’ve done so far:
    1. I changed the URL in the wp-admin from wordpress/localhost/example to http://example.com
    2. In httpd-vhosts.conf I have:

    <VirtualHost *:80>
    DocumentRoot “${SRVROOT}/htdocs/wordpress”
    ServerName example.com

    Alias /subsite “example.com/subsite”

    ErrorLog “logs/example-error.log”
    CustomLog “logs/example-access.log” combined

    <Directory “${SRVROOT}/htdocs/wordpress”>
    #Options Indexes FollowSymLinks
    #Order allow,deny
    #Allow from all
    Require all granted
    #AllowOverride All
    </Directory>

    </VirtualHost>

    I pretty much tried every possible combination of the Options in the Directory Tags, nothing worked yet. In the error log I get “Client denied by server configuration: C:/Apache24/example.com, referer: http://example.com/

    Am I missing something vital?
    Please help!

    • This topic was modified 11 months ago by  joeztuerk.
Viewing 10 replies - 1 through 10 (of 10 total)
  • I’d remove the security lines so that you can access the site publicly.

    <Directory “${SRVROOT}/htdocs/wordpress”>
    AllowOverride All
    Options Indexes FollowSymLinks
    </Directory>

    You may not need Apache Indexes, but FollowSymLinks is nearly always useful, performance-wise, in order to prevent unnecessary lstat ownership calls.

    cicekmarket

    (@cicekmarket)

    I pretty much tried every possible combination of the Options in the Directory Tags, nothing worked yet. In the error log I get “Client denied by server configuration: C:/Apache24/example.com, referer: https://www.cicekmar.com/tuzla-cicek-siparisi

    Have you restarted httpd after editing the virtual host configuration?

    joeztuerk

    (@joeztuerk)

    Hi @speda1,

    Thank you for your quick reply. I did as you said and restarted Apache as a Windows Service. But unfortunately, the same error – 403 Forbidden – You don’t have permission to access /subsite on this server.

    Is there any other place I need to configure so that subsites aren’t blocked? Something in the ServerName? A .htaccess file? A DNS Setting I need to think of? Or something I need to change in the wp admin?

    Thanks so much,
    your support is greatly appreciated!

    joeztuerk

    (@joeztuerk)

    I also tried to change database entries to listen to my new domain but still it doesn’t work. In wp_2_posts I changed column guid from http://localhost/wordpress/?p=1 to http://example.com/?p=1.
    Then I went to my vhost and tried adding /?p=1 as Alias. Didn’t work (of course).

    It’s really frustrating to be this close.
    I can access the login page when going to http://example.com/wp-login but I can’t login.
    I can access my first page, thanks to my vhost, but as soon as I want to go to another page – ACCESS DENIED!
    What am I doing wrooong? I feel like screaming from buildings.

    • This reply was modified 11 months ago by  joeztuerk.

    It could definitely be your webroot’s .htaccess file.

    Also, check for allow,deny or require statements in any other Apache config files.

    mod_security also could be the cause.

    Check the http error logs, there may be more information there.

    joeztuerk

    (@joeztuerk)

    Hey @speda1,

    Thanks for sticking with me.
    So I changed the config file and now I get a 404 Not Found on Server for my /subdir.

    So I guess it has something to do with the pretty permalinks?
    Since I already changed the guid column in wp_posts from http://localhost/wordpress/example/?page_id=2 to http://example.com/?page_id=2 etc.

    I’d remove the security lines so that you can access the site publicly.

    <Directory “${SRVROOT}/htdocs/wordpress”>
    AllowOverride All
    Options Indexes FollowSymLinks
    </Directory>

    You may not need Apache Indexes, but FollowSymLinks is nearly always useful, performance-wise, in order to prevent unnecessary lstat ownership calls.

    https://www.dunyapara.com/

    Thank you all for your great answers. I resolved the issue with a new WordPress installation on the Domain. I apparently forgot to make some vital changes in my database to migrate successfully. Nowadays I use this great tool for migrating: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
    Works like a charm and solves the issue of serialized arrays for widgets.

    paullee357

    (@paullee357)

    Going through the exact same issue. Asked to install a mirror of my wordpress multi-site in a sub directory of our Apache server. I can get to index.html in root if need be. Once I set up for index.php though it redirects to my live site. /wp-admin gives forbidden.

    site.com is under apache24/htdocs
    site-mirror.com is under apache24/www/site-mirror.com/htdocs

    Thing is there is a https redirect that is throwing me off. I keep trying to hit http://site-mirror.com and it is always trying to take me to https://site.com

    I can’t see it in my htaccess and my mirrored database is globally replaced with site.com > site-mirror.com

    When I try to circumvent with http://site-mirror.com/wp-admin I get the 403

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘VirtualHosts for WordPress Multisite Network – Subdir Alias isn’t working’ is closed to new replies.