I'm working on an old website and I've just found something strange. Www.mysite.com redirects to www.test.com, while mysite.com (non-www) redirects to www.other-site.com.
I've checked the htacces, and it only contains rules to redirect traffic to test.com. www.other-site.com is not present in the file. So how is it possible? Where should I check if there's a rule for this redirect?
Environment:
Centos server /
Apache /
Three sites are on different servers
This could be a DNS issue. If both www.test.com and test.com point to the same server then it is all server side. Virtual hosts can sometimes be the problem if you have Apache set that way then you will need a Virtual host for both www.test.com and test.com. I would say start with the DNS, then the apache config, then the site folder.
Hope that helps.
Related
Task:
We have a several DNS aliases (ex. project1.domain.com, project2.domain.com)
DNS aliases connected to JIRA Server by IP
Need link, ex. from project1.domain.com to jira.domain.com/project/TEST1
Need link, ex, from project2.domain.com to jira.domain.com/project/TEST2
How next? any ideas?
Thank you for the Help!
On your webserver, you need as many Virtual Hosts as domains you have declared, and each Virtual Host will have one HTTP redirection.
For example :
VirtualHost project1.domain.com
RewriteEngine on
RewriteRule ^/+(.*)$ http://jira.domain.com/project/TEST1 [R]
Redirecting to different server but same domain.
I have 2 servers on different hosts. One has domain.com and the other domain.org. domain.org has more resources. Now i want to create a sub domain on the first one (sub.domain.com) and redirect to (sub.domain.org) whiles maintaining the .com in the urls.
Thanks.
It depends on what's your hosting running on (Apache, nginx etc...).
In nginx you can use proxy_pass to redirect request to another host while still preserving url:
location / {
proxy_pass http://domain.org:80;
proxy_set_header X-Real-IP $remote_addr;
}
Take look at nginx docs for more info: http://wiki.nginx.org/HttpProxyModule
Or this discussion can be helpful: http://www.webmasterworld.com/apache/4464836.htm
It may be possible to also do this by manipulating DNS records so sub.domain.com is resolved to host where subd.domain.org is running (but you need to handle HTTP Host header in webserver)
There are several ways to do it:
You need to create DNS alias aka CNAME record for sub.domain.com for redirecting to sub.domain.org (look here ( http://en.wikipedia.org/wiki/CNAME_record ) for more info). You won't need to do any moves on .com server.
You can redirect with web-server configuration. So sub.domain.com will refer to .com server and web-server will redirect it to .org. For example virtual host in apache it will look like that.
ServerName sub.domain.com
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://sub.domain.org/ [R=302,L]
Last way is redirect via website files. For example you can put index.php (if you're using php) and place in it:
Or proxy it via web-server like `nginx`. upd. as #intense suggested.
ps. I think 302 is the right variant. Not 301 =)
I'm interested in having my website show up for both of these urls - www.example.com and example.com. DNS works properly and redirects www.example.com to 184.72.232.XXX and shows the website but not example.com. I've tried 2 hostname setups:
www.example.com, canonical=true
*.example.com (unable to set canonical)
Both hostname configurations have the same result.
You'll need to add "example.com" too (and keep "*.example.com"). The wildcard only matches subdomains. If you want the www version to be the canonical hostname, you'll need to add that as well.
I'm trying to set up a Apache 2.2 to work with subdomains. I've got a domain example.de which correctly points to the IP, my site www.example.com works. Now I want a bugtracker under bugzilla.example.com. All I did was to add a vHost with Servername bugzilla.example.com, but that does not work - the error message is "Firefox can't find the server at bugzilla.example.com.". Why is that? example.com should point to the correct IP?
If you did only add the vhost the most probable problem is that you didnt add the Subdomain to your DNS - Zonefile.
I have a development server that has Ubuntu server 10.10 with an ip of 192.168.0.175.
When I enable the rewrite mod for apache2 and change the site config to allow rewrite then things get all messed up.
With rewrite turned off and allow rewrites to None then I type in 192.168.0.175/test and the site loads, but with it all turned on it changes the address to www.192.168.0.175/test and the site does not load.
Why is this happening?
www.192.168.0.175 is wrong. If you type www the browser assumes that is a domain name.
The Ip's should be prefixed with www