http://localhost is getting forwarded - apache

I am using Xampp and in my htdocs directoy I have a folder called 'task4u'. If I go to http://localhost, I'll get forwarded to the page of 'task4u' (which is a Symfony 4 application).
In htdocs I have now created a new folder for a new website but I still get forwarded to the directory 'task4u'.
I have checked the windows file 'hosts' but there is nothing related to this issue.
Where could that forwarding be set? Is that because of Symfony itself maybe?

Windows host file contains only a redirect to 127.0.0.1 (loopback address) for "localhost" (or you can configure more redirects to 127.0.0.1).
You have to give a look to httpd.conf Apache file; it should be under this path for a XAMPP installation: C:\XAMPP\apache\conf\httpd.conf. Open httpd.conf with a text editor and change it with your new directory path under DocumentRoot C:/your/path and < Directory C:/your/path/>
Remember to restart Apache server by XAMPP interface.

Related

Domain Name cannot be changed in Apache on CentOS 7

I have set up a server with a wiki and Wordpress and Nextcloud on a new Domain, let's say it's testing.com. When I was finished, I wanted to change the Domain from testing.com to realdomain.com.
The server is running CentOS 7 with httpd (apache), so I changed the ServerName in /etc/httpd/conf/ to "realdomain.com". Then I changed the VirtualHosts in all the files in /etc/httpd/conf.d.
I added the new Domain to the trusted Domains of the Wordpress, Nextcloud and wiki. I restarted the httpd service and the server itself.
Yet, when I open realdomain.com in browser, it shows me my websites, but it puts testing.com in the address field.
I tried using mod_rewrite to change the URL, but then my webbrowser tells me that the site doesnt redirect correctly and that the redirects never stop.
I tried those rewrite rules in the .conf files and in the .htaccess (not simultaneously)- no success.
I removed all my files in conf.d and created a new DocumentRoot with a simple helloWorld.html - The Url still gets rewritten to testing.com.
Are there any other locations that could have rewrite rules? Did I miss anything?
Thank you so much in advance, this is killing me!

Domain for main document root gets pointed to newly enabled subdomain document root

I have a Ubuntu 16.04 which apache2 server is running. I have a website hosted in my primary domain which the document root is /var/www/html.
I use Webmin to create a subdomain and I have given the document root as /var/www/mysite.
when I restart the server and visit the main domain, it shows the website that I hosted in the /var/www/mysite, which is the subdomain document root.
If I remove or rename the conf file under /etc/apache2/sites-available/{created-subdomain.conf} file, the main domain again shows the website hosted in the /var/www/html document root.
What are the possible causes for this. I want my main domain to show the website I hosted in /var/www/html and subdomain to show the website I placed in /var/www/mysite
Sounds like you're not setting up ServerName domain.com in your configs, so Apache simply chooses the first one (alphabetically by Config file name) to serve.

Setting up Programm-o locally

After reading the installation guide for program-o http://blog.program-o.com/documentation-v2/installation/ I was wondering how I would go about doing step 2 locally and installing it without hosting an online server?
Just put your code in htdocs directory (inside xampp instalation directory).
Then You will be able to execute your code by typing 'localhost' in your browser.
Or if you want to use other domain instead of localhost, You have to edit your hosts file.
In Windows7 hosts file is located in:
%systemroot%\system32\drivers\etc
My hosts file for example:
127.0.0.1 domain.com
I can access my code by typing for example 'domain.com' instead of 'localhost'

Removing Apache Vhost

I'm in a new pc, and the previous intern has configured a virtual host(vhost) on Apache. I'm trying to remove, because i don't accessing any project on folder "www"(wampo).It always redirected to folder "bignardi"(laravel).
I remove the lines from httpd-vhosts.conf and hosts(drivers/etc - windows).
In Wamp folder i found a folder named "vhosts" and i removed the lines to create the virtual host.

WAMP Server directing me to internet locations when I click on the folders in www folder

I installed WAMP Server on my laptop, which is running Windows 8 Pro.
I created a number of folders in the www folder in the wamp folder. My problem is that whenever I try accessing the folders from the localhost page in my web browser, I am taken to the internet page of the folder i.e. I have two folders named family & prestashop. Whenever I click on them, a tab opens in my browser directing me to http://family/ instead of http://localhost/family/
What could be the problem?
Without seeing your httpd.conf (or httpd-vhosts.conf) it is hard to say where your problem is (or why it is a problem). Usually, to set up multiple sites, you will add virtual hosts to your httpd.conf or httpd-vhosts.conf which will tell WAMP what to do when people try to access that folder. The difference between a web address that looks like http://localhost/family and http://family is probably that you have set up a virtual host which allows you to get at that directory without running through 'localhost'.
Do you have something like this in your http-vhosts.conf in C:\wamp\bin\apache\Apache<version>\conf\extras\ ?
<VirtualHost *:80>
DocumentRoot "C:\wamp/www/family/"
ServerName "family"
</VirtualHost>