Pregunta

I've set up a local Git repository outside my Sites folder. In hindsight, this was possibly a mistake.

I want to test one of the Git files, but my test html page needs to be inside the Sites folder to run with Apache under ~localhost.

So can I get the html page http://~localhost/MyUserName/test.html (which has the path MyUserName/Sites/test.html) to find the script with the path MyUserName/GitHub/myScript.js? Or does the Git folder need to move to be within Sites?

I tried the following without success:

<script src="../GitHub/myScript.js" type="text/javascript"></script>

Thanks.

¿Fue útil?

Solución

You can't reference files outside the webroot (your Sites folder, in this case); that would potentially allow access to any file on your machine.

If you want to solve this without moving your repo, you can symlink your GitHub dir into your Sites folder. On OS X, Apache should follow symlinks by default; if not, you can place a .htaccess file with Options +FollowSymlinks in the Sites folder to turn it on. (You can find the docs on Apache's Options directive here).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top