I am running xampp on windows server and I want to redirect requests from my old url to the new one. I tried editing httpd-vhosts.conf with the following code
<VirtualHost *:80>
ServerName www.urla.gr
Redirect /www.urlb.gr
</VirtualHost>
and when I tried URLA from my browser it redirected me to URLB but URLB was not responsive. Both domain names have the same A record (the xampp server in question)
Related
I created website on Amazon Web Server. I route my ip to my domain using ROUTE 53 service. but now my website is showing APACHE TEST PAGE rather then content while if i enter my ip address/wordpress it's working properly.
Any solution please?
maybe you forgot to add a virtual host in http.conf. Apache restart is needed after this.
<VirtualHost *:80>
DocumentRoot "/www/example2"
ServerName www.example.org
# Other directives here
</VirtualHost>
https://httpd.apache.org/docs/2.4/vhosts/examples.html
I have IIS enabled (fresh "install") and a port configured XAMPP install with a fresh Wordpress build.
httpd.conf (changes):
Listen 8080
ServerName localhost:8080
httpd-ssl.conf (changes):
Listen 4433
<VirtualHost _default_:4433>
ServerName www.example.com:4433
httpd-vhosts.conf (changes):
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/foobar"
ServerName foo.bar
<Directory "C:/xampp/htdocs/foobar">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
hosts (changes):
127.0.0.1 localhost
127.0.0.1 foo.bar
Tests:
http://localhost/
IIS Root (expected)
http://localhost:8080/[dashboard]
XAMPP Root (expected)
http://localhost:8080/foobar
resolves to http://localhost/foobar, displays IIS error page (incorrect, should show the Wordpress install)
http://foo.bar
displays IIS root (incorrect, should show Wordpress install)
http://foo.bar:8080
resolves to http://foo.bar (same result as above)
Honestly, at this point I have no idea what I have setup that is incorrect. I've spent all day reading forums and SO, and I'm not making any headway. Help? Am I making incorrect assumptions on behavior or do I have a mistake in my setup?
Assuming that you want both services running at the same time, that you'll mostly be working with XAMPP. This is my solution:
I'm not a fan of typing in port 8080 whenever I want to be working with XAMPP. So I just changed the post number of IIS to 82.
Start IIS (7) On the left go to YOUR MACHINE > Sites > Default Web Site
Then on the right click on bindings then a window pops up
Click on the first row and edit the port number to anyting but 80 (because 80 is the default port if you don't type in anything in
your browser)
Reset all the settings of httpd.conf, httpd-ssl.conf
Then open httpd-vhosts.conf and put this:
<VirtualHost *:80>
DocumentRoot C:\xampp\htdocs\foobar
ServerName foo.bar
</VirtualHost>
Restart your computer (httpd-vhosts.conf doesn't take effect without)
The file hosts is fine as it is.
Originally I had mydomain.com.au, but then I let it expire as I cancelled my abn. After that I started using mydomain.info instead to host my WordPress site. Recently I had my abn re-instated so I have mydomain.com.au back again finally.
I decided to do a permanent redirect from mydomain.com.au to mydomain.info, and I put this in /etc/apache2/sites-available/mydomain.com.au.conf file:
<VirtualHost *:80>
ServerAdmin me#email.com
ServerName mydomain.com.au
RedirectPermanent / http://www.mydomain.info/
</VirtualHost>
It looks the same in /etc/apache2/sites-enabled/mydomain.com.au.conf also.
I reloaded apache2 without error and now I get this error when I try to access www.mydomain.com.au either locally or from an external IP:
Database Error
Error establishing a database connection
I decided to test whether the redirect was working by putting a dummy html file in /var/www/mydomain.com.au. I reloaded apache2 and tried mydomain.com.au again. Still getting the database error.
So now i'm thinking it's a problem with WordPress. Does WordPress not allow you to do this kind of thing?
The redirect was set up incorrectly. It was working for domain.com.au but not for www.domain.com.au. It needs to be:
<VirtualHost *:80>
ServerAdmin me#email.com
ServerName domain.com.au
ServerAlias www.domain.com.au
RedirectPermanent / http://www.domain.info/
</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!
My apache2 virtual host file for example.com is as below. I'm using this with wordpress site.
I set up the site without bothering to redirect the naked domain to www. When I try and add any code to rewrite the URL it redirects back to the naked domain (301 redirect) and I'm in a redirect loop.
I can't figure out why my stack is redirecting www to naked domain. Any help appreciated. Standard LAMP stack with wordpress.
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
DocumentRoot /srv/www/example.com/public_html/
ErrorLog /srv/www/example.com/logs/error.log
CustomLog /srv/www/example.com/logs/access.log combined
</VirtualHost>
Also my DNS is set up with an A NAME for www pointing to the server IP address.