i am pretty new this kind of work. I had developed a web app using PHP. i am using XAMPP Server. Now when i am hitting http://www.mywebsite.com/myproject i got my project index page. Now what i looking is if i enter http://www.mywebsite.com it should display myproject's index page.
I am not sure what is this term called. I didn't know how to search for this solution.
Your help will be much appreciated if you can provide the term i should look for or the solution for this.
thanks
When you edit the httpd-vhosts.conf file (which is in C:\xampp\apache\conf\extra), edit the DocumentRoot property accordingly.
Your current settings are probably looking like this:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName www.mywebsite.com
</VirtualHost>
which directs you to the main htdocs folder. In order to display your project, you use www.mywebsite.com/myproject. You should change the DocumentRoot. For example:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/your-project-folder"
ServerName www.mywebsite.com
</VirtualHost>
Tested on Win 8.1 Pro x64, XAMPP 5.6.21 portable. It's working.
Open the file index.php from the htdocs in xammp ( ..\xampp\htdocs\index.php)
Change the line
header('Location: '.$uri.'/dashboard/');
to
header('Location: '.$uri.'/yoursitefolder/');
this will resolve the issue.
Related
I uploaded the laravel project on the live server. When I try the url with :
www.abcd.com.au/admin/dashboard
then it shows me a messed up site and also shows some contents that were downloaded from bootstrap template website .
And when I try this url:
www.abcd.com.au/project/public/admin/dashboard
then it shows me the correct website and neatly as the way website was designed on the localhost xampp and on the live server.
I wanted to have the url as: /admin/dashboard and not project/public/admin/dashboard
How can i set up this on the live server please?
Thanks.
It sounds like your URL is pointed to the wrong folder. In Laravel the URL must point to the project's public folder.
open your VirtualHost on your server .conf file and update DocumentRoot and try
<VirtualHost *:80>
DocumentRoot "/Path your project/project/public"
ServerName www.abcd.com.au
<Directory "/Path your project/project/public">
Options All
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
I have created virtual hosts by going to C:\xampp\apache\conf\extra\httpd-vhosts.conf
then i wrote this:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/basicwebsite/public"
ServerName basicwebsite.dev
</VirtualHost>
and then i went to hosts file in C:\Windows\System32\drivers\etc and wrote this:
127.0.0.1 localhost
127.0.0.1 basicwebsite.dev
then I stopped the apache server and again start it, normally it should have open the laravel application that we are making but when i open browser and typed basicwebsite.dev it showed an error in my browser it shows this
Screenshot of my page when i type the link
it says this site cant provide secure connection.
but it shouldn't have shown this , it should have shown the page.
What to do here?
Laragon provides this feature very well. It is easy to setup virtual host with it beacuse it provides Pretty URLs using
Auto Virutal Hosts
Learn more about laragon here
.dev is blocking by browser. Instead of that use .loc or something else
Hi can you help me about this ? because I dont know how I am supposed to solve it.
I am getting the problem if I write mysite.com/australia/ or mysite.com/australia/something ERROR 404 - PAGE NOT FOUND but if I write www.mysite.com/australia/ site is perfectly open
I am getting another problem if I write my subdomain name like this www.test.mysite.com/ it is showing Server not found but if I try test.mysite.com/ or photo.mysite.com/ then site is perfectly open
how can I solve this kind of problem?
You need to edit the apache conf file and add a server alias:
<VirtualHost *:80>
# This first-listed virtual host is also the default for *:80
ServerName www.example.com
ServerAlias example.com
DocumentRoot "/www/domain"
</VirtualHost>
See: http://httpd.apache.org/docs/2.4/vhosts/name-based.html
We have hosted multiple PHP websites in different domains in same server. Each domain have it own folder under /var/www/html. For e.g.
example1.com is pointing to /var/www/html/example1.com
example2.com is pointing to /var/www/html/example2.com
example3.com is pointing to /var/www/html/example3.com
etc..
Since Saturday, when I browse example1.com or example2.com or example3.com, it is showing same content in browser. That means every time I browse it is showing website content from /var/www/html/example3.com folder. I'm not sure how this change happened. May be one of our ex-employees changed this.
So I checked httpd.conf file in /etc/httpd/conf. Here documentroot is set correctly for all the domains. As I'm new to web administration, I'm not sure where exactly I've to correct to make all websites point to right folder.
What exactly is this problem? How will I rectify this?
Do I need to correct this in http.conf file or .htaccess file in every domain folders?
I'm struggling since yesterday. Any help is really appreciated.
Thanks in advance..
Finally I'm able to resolve the issue. I have about four websites with different domains running in this server. For couple of websites, under VirtualHost tag, DocumentRoot and ServerName were missing. After I added those values and restarted the apache server, it started working.
The incorrect entry was looking like this:
<VirtualHost *:80>
ServerAdmin demo#demo.com
ServerAlias www.example1.com
</VirtualHost>
I changed that as mentioned below:
<VirtualHost *:80>
ServerAdmin demo#demo.com
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/html/example1.com/
</VirtualHost>
Thank you all for the help.
I am trying to set up a virtual host so that I can run my .php file from Eclipse as a web page.
I follow the instructions from this discussion:
Make XAMPP/Apache serve file outside of htdocs
Scroll down to virtual hosts and the instruction is basically
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Users/Oky/Documents/eclipse/firstEclipseProject/"
ServerName firstEclipseProject.localhost
ErrorLog "/Users/Oky/Documents/eclipse/firstEclipseProject/logs/error_log"
<Directory /Users/Oky/Documents/eclipse/firstEclipseProject/>
Order allow,deny
Allow from all
</Directory>
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
The document is at /Application/XAMPP/etc/extra/httpd-vhosts.conf
Then I change the hosts file at /private/etc/hosts and at the bottom, I added
127.0.0.1 firstEclipseProject.localhost #firstEclipseProject
So, I think I am doing it right up to this point because when I fire my browser and point to firsteclipseproject.localhost, it redirects me to
firsteclipseproject.localhost/XAMPP/
which is the main XAMPP web page. It does not return an object/page not found which means the redirecting is somewhat working.
So, in /Users/Oky/Documents/eclipse/firstEclipseProject/
I created a php file called HelloWorld.php but when I point to firsteclipseproject.localhost/HelloWorld.php, it says object not found! I also tried firsteclipseproject.localhost/XAMPP/HelloWorld.php and it fails.
Any help is appreciated! Thanks!!!
I would suggest you leave the root directory the way it is and instead setup an Alias to your eclipse directory.
Did you restart apache after making config changes?