PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 3, 2022

[FIXED] Htaccess doesn't work on MAMP with multiple sites

 February 03, 2022     .htaccess, mamp     No comments   

Issue

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!


Solution

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>


Answered By - anubhava
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing