Roots Discourse

Bedrock - Beginner's Guide

I’m trying to install Bedrock for the first time. I am using WAMP and I have a problem to configuring it.
.env file:

DB_NAME=uid
DB_USER=root
DB_PASSWORD=

# Optionally, you can use a data source name (DSN)
# When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables
# DATABASE_URL=mysql://database_user:database_password@database_host:database_port/database_name

# Optional variables
DB_HOST=localhost
DB_PREFIX=wp_

WP_ENV=development
WP_HOME= http://localhost/bedrock
WP_SITEURL=${WP_HOME}/wp

httpd-vhosts.conf

<VirtualHost *:80>
        DocumentRoot "${INSTALL_DIR}/www/bedrock/web"

        DirectoryIndex index.php index.html index.htm

        <Directory "${INSTALL_DIR}/www/bedrock/web">
            Options -Indexes

            # .htaccess isn't required if you include this
            <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteBase /
                RewriteRule ^index.php$ - [L]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule . /index.php [L]
            </IfModule>
        </Directory>
</VirtualHost>

Now at http://localhost/bedrock I have a list of folders / files.
I want the site to have a http://localhost/bedrock url address and the panel to http://localhost/bedrock/wp
I also don’t know what url address should be entered in the database.

please be patient :slight_smile:

VirtualHost doesn’t manage directories; it only determines host behavior. You’re probably looking for Alias: https://httpd.apache.org/docs/2.4/mod/mod_alias.html#alias

Actually, I’d like to run Bedrock with the standard options. Is mod_alias editing necessary?

You aren’t running bedrock with the standard options:

The most basic Bedrock configuration has it running from the root url, not a subdirectory. AFAIK VirtualHost isn’t capable of distinguishing between requests for the domain and requests for a subdirectory in the way you’re describing.

So far as I know, if you want the subdirectory behavior then you will need to create a configuration that differs from the examples in the documentation; either you modify the DocumentRoot and rewrite rules so that there is a subdirectory in your server root called bedrock from which files are served, or you use an Alias.

1 Like