Dino Geek, try to help you

How to redirect a subdomain to a specific folder in Apache?


To redirect a subdomain to a specific folder in Apache, you need to use virtual hosts configuration.

1. Edit your `apache2.conf` or `httpd.conf` file, which typically located in `/etc/apache2/` or `/etc/httpd/` directory.

1. Add the following lines to the end of the file:

\`\`\`bash ServerName subdomain.example.com DocumentRoot /var/www/html/specific-folder \`\`\` This tells Apache to serve files from `/var/www/html/specific-folder` when someone accesses `http://subdomain.example.com`.

1. Save the configuration file and then close it.

1. Finally, check the configuration syntax with this command:

\`\`\`bash apachectl -t \`\`\` If everything is OK, it will show `Syntax OK`, otherwise, you should correct the syntax and check it again.

1. After that, restart or reload apache service to make effect:

\`\`\`bash sudo systemctl restart apache2 \`\`\`

NOTES:

- Don’t forget to replace `subdomain.example.com` and `/var/www/html/specific-folder` with your real subdomain and folder.
- Make sure DNS is properly configured for your subdomain to point to your server IP.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use