Re: apache redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Mandy Singh wrote:
Hi,

[SNIP]

Want to learn 2 things -
1) Redirection without url bar url getting unchanged

For this there is an incredibly simple fix, which is often overlooked.
This is too add an alias to the vhost so that is will serve the content for both www. and suddomain.

	<VirtualHost *:80>
	...
	Servername www.exmaple.com
	ServerAlias subdomain.example.com
	...
	</Virtualhost>


Alternatively you could use reverse proxy, if the server that hosts www. is on an alternate server this is particularly useful.

	<VirtualHost *:80>
	...
	Servername suddomain.exmaple.com

	ProxyPass / http://www.example.com/
	ProxyPassReverse / http://www.example.com/
	ProxyPreserveHost On
	
	...
	</Virtualhost>


2) Redirection with url also getting changed to www.example.com <http://www.example.com>

Ok, this is very easy.

	<VirtualHost *:80>
	...
	Servername subdomain.exmaple.com
	Redirect permanent / www.example.com
	...
	</Virtualhost>

This is a simple example of how to redirect your subdomain to www, whilst ensuring the address bar is changed also.

What's the best way to do this?

This really does depend on your environment, but consider the load implications of proxying if the host is local, use something simple like the alias option.
At how many levels can this happen (DNS, Apache, etc)?


Which the best place to do this?

Most certainly within Apache, as it gives you finer control over what is or is not affected.
Any good documentation (easy to understand redirection doc somewhere)?
The main HTTPd docs are very good, http://httpd.apache.org/docs/
Or the HTTPd wiki  http://wiki.apache.org/httpd/



Let me know.
Thanks in advance,
Mandy.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux