I have been using apache server. I want to redirect some URL to another, eg. www.abc.com to localhost:8080/Home
I uncommented rewrite module in httpd.conf in conf folder of apache installation. Then I wrote rewrite rule like show below in httpd.conf file.
RewriteEngine On # Turn on the rewriting engine
RewriteRule http://www.abc.com http://localhost:8080/Home/
But nothing happened. It is simply opening abc.com as normal. There is no error message not even in log.
Can anyone suggest where the problem is?
You can only rewrite URLs that have the server as a host. Since you do not host www.abc.com, you cannot rewrite any of its URLs.
It's not the 'best' solution, but I use it at home.
Edit the 'hosts' file on your own PC to redirect. For example, mine redirects 'attic' to ip 10.0.0.5, my server in the attic. So when I type attic/myfolder, I get what I would normally get at 10.0.0.5/myfolder.
Your hosts default location can be found with a very quick google.
Not the best, as I say, but it works.
EDIT:
Okay, something.something, we'll call it xyz.com.
We need 2 things here;
a) your server must expect traffic from xyz.com
(this is just a config on the server, easy to achieve).
b) your browser must be pointed to your server when you type xyz.com.
Normally, when you type xyz.com into any browser, your PC will connect to a DNS server to find out where in the world xyz.com actually is (the DNS server returns an IP address). To inform the DNS servers that xyz.com should point to YOUR server, you need to pay to register the domain name with a registrar (unassigned domains aren't expensive). This is the best way, as every computer will now know how to get to your server by typing xyz.com. When you move your website to a hosted server, you go to your registrar's website and change the settings, saying "stop pointing to the IP of my home server and start poionting to the IP of my hosted server".
Or, if you don't want to do that, you need to tell YOUR PC to skip the DNS check, and you do that by modifying your hosts file as above. This will only work for you, but is enough for home testing purposes.
The third option is running your own DNS server, and manually telling it to override the world-wide settings for xyz.com. That way your browser would get your custom result when it checks the DNS server, and forward straight to your server. However, running your own DNS server is a complex undertaking, and is overkill for your current task.
In summary, from best option to worst:
1) Register your domain and point it home
2) Modify your hosts file to bypass DNS checking
3) Run your own DNS server, and override the settings for xyz.com
Hope I've been more clear this time :O)
Related
So I setup a subdomain off my regular domain. I then make an A record on Cloudflare to point to the IP address of my server. However, whenever I go to the subdomain, it just takes me back to the main hostname. (So i have sub.domain.com and when I go to sub.domain.com in my browser, it redirects me back to domain.com)
What could be the issue? I've checked .htaccess.
I've had similar issues with cPanel and Cloudflare before where cloudflare won't properly direct to the proper subdomain.
This is very difficult to look at without knowing the actual domain or subdomain in question. We don't do anything that would put a redirect in by default, so it sounds like it may be an issue on your server directly.
How do I remove the need to type /web on the end of my PLEX media server to access from outside my network? I have a no-ip.com account and set up a static domain name to point to a static ip. But that doesn't help much, because I still need to type in the /web to access my media server. I am using windows 7. I have set up a owncloud server before and removed the need to type /owncloud in the httpd.conf file. But I can't find it for the plex server. I read somewhere to set up a page that will redirect to /web, but I don't know how to do that. Thanks for help!
You can remove both the port (in case you are already not forwarding it from port 80 to Plex's port) and the need for the /web at end using redirection rules.
Here is a good example of how to do just that (this solution uses Apache):
http://matt.coneybeare.me/how-to-map-plex-media-server-to-your-home-domain/
EDIT: Small correction, that site I linked is not using redirection rules, it is using a reverse proxy.
With a redirection rule if you type: myPlexServer.com, you'll be redirected to myPlexServer.com:32400/web (as in, the address on your browser will actually be re-written to that, same as clicking on a link that takes you to another page).
With a reverse proxy, you effectively have a man in the middle, the reverse proxy server itself. You send requests to myPlexServer.com (Apache server in this case), it receives those requests and the proxy forwards them to myPlexServer.com:32400/web (PMS Server). The PMS server sends the reply to the Apache server and the Apache server sends the reply back to you. As far as PMS is concerned, the client requesting info is the Apache server, in fact it doesn't even know about you talking to the Apache server.
Ok, so bit of noob question - having one of those days.
I have set up a home apache web server on Ubuntu. I have configured vhosts as I want to host multiple websites. These work fine in the local browser, e.g.
http://site1
http://site2
both display their various contents.
For the server side of things, I've configured port forwarding on my router to send all port 80 requests to the server IP.
When I go to an external browser and type in my servers external IP address I get the standard apache "It works!" message. When I type in ipaddress/site1 I get 404. The site1 is not in the standard apache default directory, I have it in home/username/Sites/site1 folder and httpd.conf file knows this.
How is it I can access these site1 and site2 sites externally?
Cheers
Just as you would do in your local browser. So typing in http://site1 would lead you to the first site. This is based on an assumption though, which is that you put the http://site1 address in your /etc/hosts file. When your computer looks up an URL, it first checks the hosts file (and your case will find the correct IP address there) and next will ask a global mechanism for the address.
The reason why it doesnt find anything at "ipaddress/site1" is because of the vhosts configuration. This teel Apache serve the content of a folder somewhere on your server as a separate hostname, e.g. http://site1. If you're requesting "ipadress/site1", you're actually telling Apache to look in the folder "site1" in its first root it encounters in your Vhost configuration.
i am new to web hosting, but i purchased a domain from namecheap.com and i purchased web hosting from ramnode.com to host my domain, i am using centOS 32bit as my server, and i have pointed my domain to ramnode nameservers that were provided to me.
The problem i am having here is that everytime i load my website, it just says
Index Of/
cgi-bin/
even though i have placed my web page files in var/www, and var/www/html like ramnode support told me too, it still does not want to work. Any suggestions?
It all depends on how your server is setup but here are a few things to check.
What are the permission levels for your files, who owns them and what group are they in? If you don't have proper permissions set they may not show. If the wrong person owns them they may not show.
Read over your httpd.conf (centos should have it in /etc/httpd/conf) see how your server is setup. It may not have a default setup, perhaps your using a virtual host?
In a nutshell we need more information to help you out.
You should have an
.htaccess or htaccess.txt file in your WWW root, whithin that file you need the following line:
DirectoryIndex index.htm index.html index.php
That is the priority order of your index page. (Your web project needs an index page)
So in otherwords your webserver will serve the first matching file that it finds in that list.
A quick fix if you cant find the htaccess file, is just make sure you have an index.html file in your var/www
I just reset my nameservers to point to ramnode's last night and am experiencing the same issue as the OP this morning.
I previously had no FQDN for the ramnode server and simply used my /etc/hosts file locally to point to the ramnode server. Through that method, I was able to make sure everything was setup just so - apache virtualhosts, .htaccess files, apache.conf, and httpd.conf files all operating as desired.
It seems to have something to do with the installation of the cpanel, which auto-fills DNS A records with a different IP than the one I was provided. changing it to ramnode's original IP simply leads to the same cgi-bin directory index. But going going to the original ip in the browser leads to my site, as I have the apache virtualhost set for the IP.
Ramnode sets subdomain a records such as cpanel.mydomain.com all set to the same new IP and those do function, so it leads me to believe a ramnode server is capturing the trafic elsewhere and should be sending it on but isn't.
It's a bit confusing where cpanel is taking me and why redirecting to my the domain.com. A record to the original IP seems to have no effect.
I have a WAMP home web server up and running on a static IP and registered a domain with Namecheap, but I'm a bit shaky with DNS. At first I used URL Redirect and pointed it to my IP. This meant that when you typed in the domain (like example.com) it just redirected you right to my IP, replacing the domain name with it in the address bar. Now I'm trying to get the domain to show instead of the IP in the address bar, which I'm struggling to understand exactly how to do.
The latest thing I've tried which many people say to do is instead of using URL Redirect to use the A (Address) record type and point it to my IP, which I thought would finally fix my problems. Of course after 15 min or so when it all got updated I'm getting a 400 Bad Request with nginx under it in Firefox, and a blank page in Chrome. Now I'm getting blank pages in both. Did I do something wrong here? Do I need to edit something on the web server such as httpd.conf? Am I going at this completely wrong?
Yes you should do away with the redirect and instead create an "A record". The sub-domain entry would typically be, but is not restricted to "www". The record type "A" and destination/target would be your external IP address. Once you update this record it may take several hours before you notice it taking effecting, upon where on people typing your URL would be directed to your web server.
You will need to forward port 80 on your router to the server hosting WAMP.
Finally the WAMP server should be provided with your domain name so it knows which site to load. If use the VirtualHost file this will allow you to host multiple domains on your web server. To do this...
Uncomment the following line so it appears like below in your Apache httpd.conf, to allow Apache to use virutal hosts
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Then locate the httpd-vhosts.conf file, should be found in your WAMP installation location, such as C:\wamp\bin\apache\apache*version_number*\conf\extra\
Add an entry for your site, altering the details to your own domain name and website location.
<VirtualHost *:80>
ServerName www.stackoverflow.com
ServerAlias stackoverflow.com
DocumentRoot "C:/websites/stackoverflow/"
ErrorLog "C:/websites/stackoverflow/logs/error.log"
CustomLog "C:/websites/stackoverflow/logs/access.log" common
</VirtualHost>
Now restart your WAMP server and give it a whirl.
Tip: If your server won't start after these changes, check that you have created the folder structure for the log files!
Solution described here could resolve this issue.
Most of the free dynamic dns providers, allow acquiring more than one free host name. If allowed you can solve the problem by getting a second name, e.g., mysite2.somefree.org.
Now, go and configure your free domain names in the dashboard of free provider in the following way (assume your IP is 188.165.15.29 and your server's listening to port 8085).
redirect mysite1.somefree.org to mysite2.somefree.org:8085
redirect mysite2.somefree.org to your dynamic IP, say, to 188.165.15.29
This also works when you are using Apache httpd server alone, not being part of WAMP. You do not need to tweak virtual host or any part of your server. You only configure inbound direction.
Use Forward with masking where you registered your domain. mine is GoDaddy.
in the forward settings, you will see this at bottom of the page. click Forward with masking and add the title you want them to see in the address bar of the browser when they go to your site. instead of showing your IP address