Phyron
Phyron

Reputation: 633

Htaccess doesn't work on MAMP with multiple sites

I have 3 sites on MAMP local server but in 2 of 3, the htaccess doesnt work. I add this code in httpd.conf (MAMP->apache):

NameVirtualHost * 

<VirtualHost *> 
DocumentRoot "c:/MAMP/htdocs" 
ServerName localhost 
</VirtualHost> 

<VirtualHost *> 
DocumentRoot "C:\codes\Bedloop" 
ServerName local.bed.com
</VirtualHost>

<VirtualHost *> 
DocumentRoot "C:\codes\apart" 
ServerName local.apart.com
</VirtualHost>

And this lines on windows hosts file:

127.0.0.1    local.bed.com
127.0.0.1    local.apart.com

I put on 3 pages, the same files (same page), but htacces only work on the localhost page, not in other 2. The main page work fine, but urls with rewrite rules fails.

I need to config something more?

Thx!

Upvotes: 1

Views: 655

Answers (1)

anubhava
anubhava

Reputation: 785481

NameVirtualHost is deprecated. Can you try these directives in your Apache vhost file and restart apache:

<VirtualHost *:80> 
   ServerName localhost 
   DocumentRoot "c:\MAMP\htdocs"
   <Directory "c:\MAMP\htdocs">
      Options Indexes FollowSymLinks MultiViews ExecCGI
      AllowOverride All
   </Directory>
</VirtualHost> 

<VirtualHost *:80> 
   ServerName local.bed.com
   DocumentRoot "C:\codes\Bedloop"
   <Directory "C:\codes\Bedloop">
      Options Indexes FollowSymLinks MultiViews ExecCGI
      AllowOverride All
   </Directory>
</VirtualHost>

<VirtualHost *:80> 
   ServerName local.apart.com
   DocumentRoot "C:\codes\apart"
   <Directory "C:\codes\apart">
      Options Indexes FollowSymLinks MultiViews ExecCGI
      AllowOverride All
   </Directory>
</VirtualHost>

Upvotes: 1

Related Questions