开发者

Having a url of : 'example.com' instead of 'localhost:8888/drupal' [Mamp]

How can i run local tests ( with mamp ) that have urls of this kind : www.example.com instead of http://localhost:8888/insta开发者_如何学Cll.folder

Thank you


If your tests are truely local, you may simply add an alias in your hosts file (/etc/hosts on linux). This alias will cause your computer to resolve www.example.com as 127.0.0.1 (localhost).

If you wish to use this outside of your computer, you will need to purchase a domain, and set its DNS up to forward to your IP address (and open the appropriate port in your router to forward to your computer).

If you don't want to have to include the port number (':8888'), change the port that your server is being hosted on to the default (80). This may be done through the server's configuration file by changing the 'Listen' directive.

If you do not want to have to add the '/drupal' path, add an 'Alias' directive to redirect the user from the root path ('/') to '/drupal'. You may also change the 'DocumentRoot' to drupal.


You will need to add an entry to your hosts file like this:

127.0.0.1    www.example.com

Note: this will not keep you from having to enter the port number or directory - it will only allow you to use a host alias for the host name itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜