I've added a Virtual Host to my httpd-vhosts.conf
file like this
<VirtualHost *:80>
DocumentRoot "/website/sub"
ServerName sub.localhost
</VirtualHost>
I also have two .htaccess files (for the moment identical), one for localhost and one for sub.localhost
website/.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
website/sub/.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
Now if I open http://sub.localhost
in my Chrome it works as expected. However when I open it in Safari, Firefox or Opera I get a message basically saying that the server was not found.
What am I missing?
答案 0 :(得分:1)
I think that Chrome will make some magic and resolve all subdomain of localhost to 127.0.0.1.
You have to add 127.0.0.1 sub.localhost
to your host file