# Rocket.Chat in Apache subdir not working

**URL:** <https://forums.rocket.chat/t/rocket-chat-in-apache-subdir-not-working/1873>\
**Category:** Community Support\
**Created:** [August 22, 2018, 3:54pm UTC](https://forums.rocket.chat/t/rocket-chat-in-apache-subdir-not-working/1873 "2018-08-22T15:54:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![haagen](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@haagen](https://forums.rocket.chat/u/haagen)\
**Post date:** [August 22, 2018, 3:54pm UTC](https://forums.rocket.chat/t/rocket-chat-in-apache-subdir-not-working/1873/1 "2018-08-22T15:54:16Z")

</div>

Hello everyone,

unfortunately I will need some help after some ( more like 50… ) tries. I am not able, by any means to configure RocketChat to be available in subdirectory. **HELP IS GREATLY APPRECIATED!**

I either get a blank page or 404 not found (Rocket chats message).

I have followed this guide: [https://rocket.chat/docs/installation/manual-installation/running-in-a-sub-folder/](https://rocket.chat/docs/installation/manual-installation/running-in-a-sub-folder/)

But it didn’t help, or I might have not understood correctly, but either way, it does not work.

Here is my Apache config (I’ve been messing with rewrite paths but I can’t get it right):

```
<VirtualHost BLABLA>

ServerName mypage.com
ServerAdmin admin@page.com
DocumentRoot /var/www/html/page #there is my main page

ErrorLog /var/log/rror.log
TransferLog /var/log/access.log
LogLevel info

Location /chat>
    Order allow,deny
    Allow from all

    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /var/www/html/page/(.*) ws://localhost:8080/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    RewriteRule /var/www/html/page/(.*) http://localhost:8080/$1 [P,L]

    ProxyPassReverse http://localhost:8080
</Location>

<VirtualHost>

```

Settings in mongo;

```
> use rocketchat
switched to db rocketchat
> db.rocketchat_settings.find({ "_id" : "Site_Url"}).pretty()
{
        "_id" : "Site_Url",
        "_updatedAt" : ISODate("2018-08-22T15:27:46.449Z"),
        "autocomplete" : true,
        "blocked" : false,
        "createdAt" : ISODate("2018-08-21T17:31:46.319Z"),
        "group" : "General",
        "hidden" : false,
        "i18nDescription" : "Site_Url_Description",
        "i18nLabel" : "Site_Url",
        "packageValue" : "https://mypage.com/chat/",
        "public" : true,
        "sorter" : 1,
        "ts" : ISODate("2018-08-22T15:27:46.449Z"),
        "type" : "string",
        "value" : "https://mypage.com/chat/",
        "valueSource" : "packageValue"
}

```

Systemd unit file (I have tried different settings…):

```
[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target mongod.target
[Service]
ExecStart=/usr/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=root
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat
Environment=ROOT_URL=https://mypage.com/chat/
Environment=PORT=8080
[Install]
WantedBy=multi-user.target
```

---

<div class="post-metadata">

**Author:** ![chatdev](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/chatdev/32/481_2.png) [@chatdev](https://forums.rocket.chat/u/chatdev)\
**Post date:** [August 22, 2018, 11:19pm UTC](https://forums.rocket.chat/t/rocket-chat-in-apache-subdir-not-working/1873/2 "2018-08-22T23:19:58Z")

</div>

Ok, this is maybe not the solution you want to hear, but why aren’t you simply using a subdomain like [https://chat.mypage.com](https://chat.mypage.com) ? That way installation should be a lot easier.

You could still work with the chat subdir and redirect it to the subdomain.

Just my two cents…

Stef

---

<div class="post-metadata">

**Author:** ![haagen](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@haagen](https://forums.rocket.chat/u/haagen)\
**Post date:** [August 24, 2018, 3:14pm UTC](https://forums.rocket.chat/t/rocket-chat-in-apache-subdir-not-working/1873/3 "2018-08-24T15:14:25Z")

</div>

Well, that seriously didn’t even cross my mind and now I feel stupid. This is the most obvious way to approach this. Thank you very much.

---

<div class="post-metadata">

**Author:** ![chatdev](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/chatdev/32/481_2.png) [@chatdev](https://forums.rocket.chat/u/chatdev)\
**Post date:** [August 26, 2018, 5:34pm UTC](https://forums.rocket.chat/t/rocket-chat-in-apache-subdir-not-working/1873/4 "2018-08-26T17:34:17Z")

</div>

It doesn’t matter. Sometimes you are focussed on the problem too much and less on the solution. I am a RC starter too so I stumbled on a lot of problems myself too.

Have fun!

Stef
