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

Friday, February 18, 2022

[FIXED] Virtual hosts on mamp pro, domain with and without www

 February 18, 2022     mamp     No comments   

Issue

In Mamp pro I want both the www.test.com and test.com domains to be redirected to the same folder on localhost, do I have to enter them both or is there some option to automatically apply the settings of one to the other so i don't have to enter them both?


Solution

Use a ServerAlias in the virtual host config. For MAMP PRO you should be abale to just add ServerAlias test.com to the Customized virtual host general settings box on the Advanced Virtual Hosts Configuration tab.

Otherwise, locate the virtual host declaration in /Applications/MAMP/conf/apache and add it manually.

<VirtualHost *>
  DocumentRoot /Applications/MAMP/htdocs/test.com/
  ServerName www.test.com
  ServerAlias test.com
  <Directory "/Applications/MAMP/htdocs/test.com/">
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>

You will need to restart Apache to make the configuration active.

Apache docs



Answered By - PassKit
  • 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