0

I started working on my final project. As my plan is to build a website, where users can log several parameters of their health, I have been trying to take the framework from pset7.

Because I want my work to be accessible from my mac OS. I basically copied the whole pset7 directory to a new folder in ~/vhosts/localhost/ called project.

Now I know that to make pset7 work, there was this line 127.0.0.1 pset7 that you had to add to /etc/hosts.

How can I make this "reroute" work for my final project? My problem is, that if I use the function

redirect("/");

In pset7, this would have redirected to pset7/public/, but in my project this redirects to

Appliance-IP-adress/                    - where it should be:
Appliance-IP-adress/project/public

I'm getting lost here with the server configurations :(

2 Answers 2

1

if you put the final project folder in the same root directory that your pset7 folder was in, you should be able to modify the file accordingly, replacing

127.0.0.1 pset7

with

127.0.0.1 finalproject   

or whatever your folder name may be.

Regarding the reroute - the code that controls this is actually tucked away in the included config.php or functions.php file, I believe. If you open those up in gedit, you should see the underlying code that tells redirect what to do and where to look, and you can modify it as needed.

5
  • Thanks! Although I think I can't access it now with my Mac OS
    – Jesse
    Commented Nov 4, 2014 at 13:34
  • You should be able to access it the exact same way you did for CS50 Finance, from within the appliance. If you are trying to access from your Mac OS, you will have to access it like you did for pset8, shuttle. You will need the IP address of your virtual machine, listed in the bottom right hand corner of your appliance. Refer to pset8 setup for help
    – lethaljd
    Commented Nov 4, 2014 at 18:57
  • Okay, so I copied my project folder from ~/vhosts/project (pset7 setup) to ~/vhosts/localhost/public/project (pset8 setup). Now I can access the my project from my Mac OS, but only if I type in *ip-adress appliance*/project/public (where my index.php is located). Do you know how to set the rule in /etc/hosts, so that I only have to type *ip-adress appliance*/project to access my project? Thanks a lot already!
    – Jesse
    Commented Nov 5, 2014 at 10:10
  • Also, after I moved my project directory to localhost/public, my redirect function doesn't work as intended anymore. This also has to do with the line in /etc/hosts
    – Jesse
    Commented Nov 5, 2014 at 10:26
  • You will have to modify your config.php and/or functions.php (I forget where redirect is defined) file again to update the redirect function to the new folder structure and location. I don't know how to change the default root folder, but would suggest looking on stack exchange for Apache virtualhost directory. Lots of good info there.
    – lethaljd
    Commented Nov 5, 2014 at 12:07
1

There's a nice step by step tutorial in DigitalOcean on configuring vhosts in Ubuntu. If you're lucky enough, you may find relevant information regarding apache on mac os as well...

Here is also their "Security Forum", with many tutorials and Q&A on those topics.

HTH!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .