So we all know that to access your site inside htdocs you have to type "localhost/yoursite folder" right? but i have managed to change that by some help of my friend. now my friend is gone so i cant ask him to change it back. Instead of "localhost/yoursite" i can access it through "mysite.test" it has something to do with host.txt in system32. Now the problem is im installing a new drupal site in htdocs again and i cant access it since my localhost is always pointing to my first drupal site. how do i configure this?
HERE'S MY HOST.TXT
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 activate.adobe.com
127.0.0.1 drupal6.test
127.0.0.1 belmark.test
drupal 6 is my previous site. and belmark.test is the site i want the localhost to direct to which is not working. even if i omit the drupal6.test line localhost still directs to drupal6.test
and here's my httpd-vhost.conf
<VirtualHost *:80>
ServerAdmin cadaybelmark#gmail.com
DocumentRoot "C:/xampp/htdocs/drupal6"
ServerName drupal6.test
ServerAlias drupal6.test
ErrorLog "logs/drupal6.test-error.log"
CustomLog "logs/drupal6.test-access.log" combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin cadaybelmark#gmail.com
DocumentRoot "C:/xampp/htdocs/drupal7"
ServerName belmark.test
ServerAlias belmark.test
ErrorLog "logs/drupal.test-error.log"
CustomLog "logs/drupal.test-access.log" combined
</VirtualHost>
You need to configure apache (via xampp) with additional vhosts, one for each site.
A vhost configuration maps a ServerName with a DocumentRoot. For example,
ServerName localhost
DocumentRoot /path/to/my/drupal
If you want a new, second site, you will need a second vhost for it. If you simply want to replace the original site with a new Drupal installation, your original vhost can stay the same (as long as you put in the exact same place as the original, which it sounds like you did not, since the old site is still loading).
See the XAMPP documentation for how to add/edit vhost entries.
not sure if i understood your problem right
create a subfolder in htdocs and install it there.
127.0.0.1/subfolder/yoursite
My god the answer is so simple. Apache just needs to be restarted. OK! thanks for the efforts guys.
Related
I have installed MAMP (free version) on my Mac and I see the Start Page but I have a problem:
I deployed wordpress but browser say unable to connect (basically I cannot see wordpress page in browser).
In Document Root if I put a static html file I am able to see it in the browser. I am also able to see wordpress administrative pages and all other pages but home page. I have 8888 and 8889 for php and mysql ports. I do not know how to debug the issues. php, apache and mysql do not report any particular problems.
I configured virtual hosts following this guide:
http://foundationphp.com/tutorials/vhosts_mamp.php
The strange thing when I put http://localhost:8888/mywebsite in the browser it is redirected to localhost/mywebsite.
In /etc/hosts I have:
127.0.0.1 localhost
In httpd.conf I activated:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
and in this file I have:
NameVirtualHost *:8888
<VirtualHost *:8888>
ServerAdmin myuser#gmail.com
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
ErrorLog "logs/mywebsite-error_log"
CustomLog "logs/mywebsite-access_log" common
</VirtualHost>
Hope someone could help.
I found the solution. After several debugging I found that this guide is correct: http://foundationphp.com/tutorials/vhosts_mamp.php
You need: 1. In /etc/hosts add your virtual hosts like:
127.0.0.1 localhost
127.0.0.1 mywebsite
before I only used localhost because I hoped to use this host in browser but I found it's required to define a new host like mywebsite.
In httpd.conf I activated:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
In this file I have:
ServerAdmin myuser#gmail.com
DocumentRoot "/Applications/MAMP/htdocs"
ServerName mywebsite
ErrorLog "logs/mywebsite-error_log"
CustomLog "logs/mywebsite-access_log" common
Currently, I have configured a domain I bought through GoDaddy to point to the elastic ip address of my personal ec2 instance. I'm having issues finding the correct solution to configure my httpd.conf such that my custom domain, example.com points to a specific subdirectory var/www/Example. Further, I want to be able to still access my other projects and sites by simply typing in the elastic ip and subdirectory.
I have tried the using a virtual host with the following configuration..
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "/var/www/html/Example/wordpress"
ServerName fitnessfifteen.com
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" common
</VirtualHost>
When I do this, I can access the correct content by going to www.example.com however, I'm unable to access my other files and projects via 11.11.111.111/OtherProjectDirectory (I get that default internal server error page). I'm completely new to this sort of stuff so many this isn't possible and I have a fundamental misunderstanding.
Add another virtual host to http.conf as below and restart apache.
<VirtualHost *:80>
ServerAdmin webmaster#example.com
DocumentRoot "/var/www/html/Example/wordpress/OtherProjectDirectory"
ServerName 11.11.111.111
ErrorLog "logs/example.com-error_log"
CustomLog "logs/example.com-access_log" common
</VirtualHost>
I installed XAMPP on my windows server and also installed Wordpress XAMPP module. I also bought a domain to point it to my server ip. Thing is , I want that when people enter mydomain.com , mydomain.com shows in the address bar and that it keeps showing while browsing.
First I tried to point the domain to my ip , and when I go to mydomain.com it shows mydomain.com/xampp
Then I tried to changing:DocumentRoot "C:\xampp\htdocs"
<Directory "C:\xampp\htdocs">
in httpd file in C:\xampp\apache\conf
to
DocumentRoot "C:\xampp\apps\wordpress\htdocs"
<Directory "C:\xampp\apps\wordpress\htdocs">
But this time when I enter mydomain.com it redirects to myipaddress.com/wordpress
All I want is:
1)When someone enters mydomain.com , he will see my wordpress home page.
2)Whenever a user is browsing mydomain.com , he will always see mydomain instead of myipaddress.
Any help would be appreciated.
Regards!
Type this at the bottom of your httpd file:
Alias /wordpress "C:/xampp/htdocs/wordpress/"
<Directory "C:/xampp/htdocs/wordpress/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Please take note that the directory that I stated above is a sample of a default directory. I am having a hard time trying to figure out your directory but the above example should make sense. After typing the codes on your httpd file, go to the directory of xamp/apache/conf/extra/ and openup the httpd-vhosts file. Type this at the bottom of the httpd-vhosts file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.yourdomain.com
ServerAlias yourdomain.com
ServerAdmin email#yourdomain.com
DocumentRoot "C:\xampp\htdocs\wordpress"
</VirtualHost>
Double check your host file if you already entered this line:
127.0.0.1 yourdomain.com
Restart your Apache webserver. Hope this helps!
Old hand with WordPress and a lot of multi-site experience here. But I am chewing on best way to route a subdomain of a TLD already domain mapped on the MS installation.
EXAMPLE: TLD is A-Recorded to the WP multi-site via IP and correctly resolves. Say it is MAPASITE.com and that is correctly finding the right blog. Now if I want to next map a subdomain of that TLD -- say subdomain.MAPASITE.com -- to a page on the blog, what is the best way to do so?
I thought about .htaccess and 301 redirects but am not sure if there might be a simpler c-Record or forwarding method direct from the Registrar? Thanks for the help.
I don't know if it works for wordpress pages aswell but you can make virtualhosts in your apache installation and set a different document root for a subdomain. I use this, but I don't use wordpress.
In case this might solve it: to change the documentroot (where the user lands when visiting a domain) just make a new .conf file in the directory where your apache installation stores its configs. These lines should do it:
<VirtualHost *:80>
DocumentRoot /var/www
Options -Indexes
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/somemap
ServerName subdomain.example.com
ErrorLog /var/log/apache2/someerrorlog
CustomLog /var/log/apache2/someaccesslog combined
Options -Indexes
</VirtualHost>
You can skip the ErrorLog and CustomLog parts if you don't want a separate errorlog and accesslog for the subdomain.
The first <virtualhost> is to set the default documentroot, just point it to whatever it now is. Since you use a MS installation it certainly is different since mine is from a Debian install.
I hope this gives a solution to your problem.
Basically what I run now on my home PC is one of these WAMP in a box applications so I can write my PHP code and use a MySQL database. That is all fine, but I run a lot of websites so now I have a folder I've called /~WEBSITES/ where I put everything making the URLs to these http://localhost/~WEBSITES/domain.com/ -- what I'd like is to be able to type http://local.domain.com/ into my address bar and have it point to my local drive, but I don't want this for everyone, just me.
Possible?
NOTE: I've running Windows XP
You'll need to setup virtual hosts with Apache, and combine that with HardCode's answer (setting your hosts file). That should do what you need.
AUTHOR EDIT: Great article, here's the quick notes on what to do (at least with the most recent version of apache2triad as your WAMP installer)
Add to C:\APACHE_INSTALL_DIRECTORY\conf\httpd.conf:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "C:\apache2triad\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:\apache2triad\htdocs\~WEBSITES\Domain1.com"
ServerName local.domain1.com
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:\apache2triad\htdocs\~WEBSITES\Domain2.com"
ServerName local.domain2.com
</VirtualHost>
Add to C:\Windows\system32\drivers\etc\hosts
127.0.0.1 localhost
127.0.0.1 local.domain1.com
127.0.0.1 local.domain2.com
Modify the text file named "hosts" found in C:\Windows\system32\drivers\etc\
Suppose you want to point www.mycustomer.com to your local host. Add in:
127.0.0.1 www.mycustomer.com
You'll need to setup virtual hosts in apache (not IIS... oops), and combine that with HardCode's answer. That should do what you need.