I trust that this post is in the correct section, if not please accept my apology.
I have XAMPP 5.6.24 installed on Windows 7 and wants to test the site from other computes/devices on my LAN. I even see the same behaviour on my android tablet after editing its hosts file.
When I type my-domain.local or my-ssl-domain.local in the browser's address bar it redirects to my-domain.local/dashboard and my-ssl-domain.local/dashboard respectively.
This is what I have done to date.
Amending the hosts files of the computers
- Code: Select all
# Added the following entries to the hosts file (C:\Windows\SYSTEM32\drivers\etc\)
# of the host computer 192.168.1.20.
127.0.0.1 www.my-domain.local
127.0.0.1 my-domain.local
127.0.0.1 www.my-ssl-domain.local
127.0.0.1 my-ssl-domain.local
- Code: Select all
# Added the following entries to the hosts file # (C:\Windows\SYSTEM32\drivers\etc\)
# of the client computer accessing the XAMPP web server from 192.168.1.21.
127.0.0.1 www.my-domain.local
127.0.0.1 my-domain.local
127.0.0.1 www.my-ssl-domain.local
127.0.0.1 my-ssl-domain.local
Edited the httpd.conf
- Code: Select all
# Made sure this module in the file was uncommented.
Include etc/extra/httpd-vhosts.conf
# Replace DocumentRoot w:/xampp/htdocs- w:/xampp/htdocs with d:/www
DocumentRoot "w:/www"
<Directory "w:/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require All granted
</Directory>
Setup of http and https redirection of vhosts
- Code: Select all
<VirtualHost localhost>
DocumentRoot "w:/www/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost my-domain.local:80>
ServerName my-domain.local
DocumentRoot "w:/www/my-domain.local"
ServerAdmin webtech@my-domain.com
# Server Aliases
ServerAlias www.my-domain.local
# setup logging
LogLevel error
ErrorLog "logs/my-domain.local-error.log"
CustomLog "logs/my-domain.local-access.log" combined
# Directory permissions
<Directory "w:/www/my-domain.local">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require All granted
Allow from 192.168.1.15/255.255.255.240
</Directory>
</VirtualHost>
# Redirect https:// traffic.
<VirtualHost my-ssl-domain.local:80>
ServerName www.my-ssl-domain.local
# Server Aliases
ServerAlias my-ssl-domain.local
# Redirect all server aliases to https://
# --------------------------------------------------------
Redirect permanent / https://www.my-ssl-domain.local
</VirtualHost>
Changes to httpd-ssl.conf
- Code: Select all
<VirtualHost my-ssl-domain.local:443>
# General setup for the virtual host
DocumentRoot "w:/www/my-ssl-domain.local"
ServerName www.my-ssl-domain.local
ServerAdmin webtech@my-ssl-domain.com
# setup logging
ErrorLog "d:/xampp/apache/logs/error.log"
TransferLog "d:/xampp/apache/logs/access.log"
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# Server Certificate:
SSLCertificateFile "conf/ssl.crt/my_ssl_domain.crt"
# Server Private Key:
SSLCertificateKeyFile "conf/ssl.key/my_ssl_domain.key"
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "d:/xampp/apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
# SSL Protocol Adjustments:
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# Per-Server Logging:
CustomLog "d:/xampp/apache/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
<Directory "w:/www/my-ssl-domain.local">
Options ExecCGI FollowSymLinks Includes Indexes
Order Deny,Allow
AllowOverride FileInfo Limit Indexes Limit
Allow from 192.168.1.15/255.255.255.240
</Directory>
</VirtualHost>
Thanks in advance for your time and effort. All help and guidance will be appreciated.