4

I installed Xampp on mac and I'm going to run my web application on local, which located on "/Data/MyApp/App".

I know I should put source codes inside htdocs. So I created an alias of "App" by right click -> Make Alias and put it to "Applications/Xampp/htdocs/". I changed alias name test. When I run localhost/test on chrome browser, I see empty screen but downloads unknown file test.

Instead, I paste whole sources(App) to htdocs with name test2 and localhost/test2 shows me correct screen according to the index.php inside of test2. Just note that file structures of test and test2 are exactly same.

Applications/Xampp/htdocs/test(alias)/index.php         // not working
Applications/Xampp/htdocs/test2(real folder)/index.php  // work well

What's wrong with this? Should I set something for making alias folder work inside htdocs?

Roy
  • 676
  • 8
  • 22
  • You need to include pertinent configuration sections and [in general adhere to these standards](https://stackoverflow.com/help/mcve) – gview Aug 08 '17 at 05:29
  • Ok, I added some more infos. Please help me for the solution. – Roy Aug 08 '17 at 05:37
  • Also, just my strong advice, but avoid xampp or any other workstation polluting environments. Go with vagrant/virtualbox or docker. You'll have an environment that can match production, which can also be easily turned on and off, as well as getting around problems that can occur with localhost environments like cookie setting. – gview Aug 08 '17 at 06:55
  • Also please provide the apache conf for the vhost, as well as ls -lathF on the directory. I believe your question can be answered by doing one or more of the following; -making sure the execute bit is set on the alias directory, making sure that followsymlinks is set for the directory statement in the apache conf. See https://stackoverflow.com/questions/6807317/fixing-403-forbidden-on-alias-directory-with-apache – gview Aug 08 '17 at 07:07

2 Answers2

6

Well, after struggling a few hours, I found what I was wrong. I removed alias folder which I created by right click -> Make Alias and created new one with this command.

cd /Applications/XAMPP/htdocs
ln -s /Data/MyApp/App test

I'm not sure what was wrong with original alias.

Roy
  • 676
  • 8
  • 22
  • Indeed! Shame Alias doesn't have the same effect :( But check out SymbolicLinker as an alternative app for Mac: https://github.com/nickzman/symboliclinker/releases – Jono Jan 23 '22 at 16:40
0

An Alias has to point to a real location on your server. For example you can create the /test alias for your real working location test2 like this:

Alias /test Applications/Xampp/htdocs/test2/

Restart apache and then you will be able to access http://localhost/test

For more information you should read how an apache alias works and how to define it:

https://httpd.apache.org/docs/2.4/mod/mod_alias.html

Bogdan Stoica
  • 4,349
  • 2
  • 23
  • 38