MAMP virtualHost does not open file under specified directory - php

I am trying to set up VirtualHost on my MAMP. I Edited the http-vhost.conf file like so:
<VirtualHost *:8888>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost *:8888>
DocumentRoot “/Applications/MAMP/htdocs/factoryPattern/”
ServerName factory
</VirtualHost>
I theory I would expect to type in my browser factory and index file under the fiven directory would open. Instead what I get when I type in Factory in my browser factoryPattern folder that I have to click and then i need to clinc index.php file to view the file content.
I would like if this would of happen automatically by typing Factory...
What am I doing wrong...?

Related

How to redirect to another url using apache vhost?

I have installed wordpress on my machine. I have two direcotory for apache to serve websites.
first is /var/www/html/wordpressone & second is /var/www/html/wordpresstwo. Now i able to access these to sites using below url
http://192.168.0.1/wordpressone -> /var/www/html/wordpressone
http://192.168.0.1/wordpresstwo -> /var/www/html/wordpresstwo
Now i want define a custom url eg.
http://192.168.0.1/admin -> /var/www/html/wordpressone
http://192.168.0.1/user -> /var/www/html/wordpresstwo
But i am not able to do it using Vhost. I tried below method but did not work.
I created a file home.conf under /etc/apache2/sites-available & enabled it.
<VirtualHost *:80>
ServerName http://192.168.0.1/user
DocumentRoot /var/www/html/wordpressone
<Directory />
Please tell me what are steps i need to perform to achieve this ?
All Depends on Document Root. It Navigates you to the given folder Just Make two host one with
http://192.168.0.1/admin
with the configuration inside
<VirtualHost *:80>
ServerName http://192.168.0.1/admin
DocumentRoot /var/www/html/wordpressone
<Directory />
and another with
http://192.168.0.1/user
with the configuration inside
<VirtualHost *:80>
ServerName http://192.168.0.1/user
DocumentRoot /var/www/html/wordpresstwo
<Directory />

local assets(css/js) not found when using apache virtual host

I've added 127.0.0.1 my.pro to my hosts file
and add below code to httpd-vhosts
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/ci4/public"
ServerName my.pro
ErrorLog "logs/myproject-error_log"
CustomLog "logs/myproject-access_log" common
</VirtualHost>
the problem is i can't reffer to my assetes. assetes and project index page are in defferent directories.
-ci4
--public
---index.php
--assets
---css
C:/xampp/htdocs/ci4/public is project root and i locate assetes in C:/xampp/htdocs/ci4/assetes .
when I try to load a CSS file with this resource http://my.pro/assets/css/style.css it shows 404 error.
I know apache tries to load file from C:/xampp/htdocs/ci4/public/assets/css/style.css which doesn't exist.
but I have no idea how to fix it!

Creating new symfony project on localhost

Hello I'm trying to run project using newest symfony on my localhost.
What i already did:
I added this to my vhosts file in Xampp.
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "F:\Programy\XAMP\htdocs\Anka\web"
ServerName Anka
DirectoryIndex app_dev.php
ErrorLog "logs/vark.local-error.log"
CustomLog "logs/vark.local-access.log" common
</VirtualHost>
I added this in my hosts file in Windows\System32...
127.0.0.1 Anka
This is what i see after typing
anka\
In my browser.
My localhost website
And when i click on web i see this:
web
Can somebody help me what else i should do to see normal Symfony index page?
Try http://anka/app_dev.php or http://anka/web/app_dev.php
Also You can Change the directory to this one with the application and run:
php bin/console server:run
Then access http://localhost:8000/ in your browser
Like this:
https://symfony.com/doc/current/setup.html#running-the-symfony-application
First of all - ServerName value is case-sensitive, to Apache is not really recognizing request as this VirtualHost and you're getting listing of root directory.
Use http://Anka url, or change ServerName Anka to ServerName anka and 127.0.0.1 Anka into 127.0.0.1 anka.
Next thing is that you have some errors in your code and PHP cannot find AnkaBundle\AnkaBundle class. You're probably missing an autoloader, but that's only my guess. Not enough information to be sure.

configuring virtual host in xampp for magento installation

I am very new to magento and php and i am trying to create a virtual host url for my magento site.
Currently the url is
http://localhost:8080/Magento/
And if i create any website i have to use url's such as below
http://localhost:8080/Magento/website1
http://localhost:8080/Magento/website2
...
After referring to several examples such as this http://sawmac.com/xampp/virtualhosts/ i have managed to configure my files such as below
Step 1:
In the file C:\Windows\System32\drivers\etc\hosts i have append the below mapping
127.0.0.1 clientA.local
Step 2:
And in the file C:\xampp\apache\conf\extra\httpd-vhosts.conf i have append the below code
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "C:\xampp\htdocs\magento"
ServerName clientA.local
<Directory "C:\xampp\htdocs\magento">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After step 1 typing typing clientA.local:8080/magento opens localhost:8080/magento
But step 2 doesn't change anything.
I want to do something as below
clientA.local should open http://localhost:8080/Magento/website1
clientB.local should open http://localhost:8080/Magento/website2
...
I have tried changing the Document root , directory in several ways nothing helped.
If any one has any idea on this senario please contribute here.
thanx

Wordpress site returning 404 error when requesting content from subfolders

I'm using WAMPSERVER to run a wordpress site that has to be acessible by the users in my network, like a environment for testing together.
Localhost works fine, but at first i couldn't access the aplication from other computers in the network. I created a rule to open the port 80, created an Alias in the Apache configuration, and it worked but the theme and any images inside subfolders wouldn't load and the console was returning lots of 404 responses.
I want to map the subfolders and its files that are under the 'base dir' of the site. I tried tons of options in the Apache conf. file but i couldn't make it.
Attached a printscreen of the responses, the apache conf file and the windows hosts file
Httpd.conf :
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#animamidia
DocumentRoot "C:\wamp\www\website"
ServerName www.animamidia
ErrorLog "logs/animamidia-error.log"
CustomLog "logs/animamidia-access.log" common
<Directory "C:\wamp\www\website\*">
Options FollowSymLinks Includes
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Windows hosts file:
127.0.0.1 www.animamidia
The site with it's theme broken because the requisition returned a 404
Well i found the problem.
Even though i couldn't enter the wordpress-admin i decided to check the 'wp-config.php' file just in case something is wrong or missing.
And what i did find is that the 'Home-URL' and the 'WP-URL' were set at 'localhost/website' which means that all the requisitions would point at this location as a base directory.
All i had to do was to use the 'define' comand and set the site's URL to the machine's IP and now the environment is all set up for the guys over here to develop and test their stuff.

Categories