How do I create an Apache redirect (url)

How do I create an Apache redirect (url)

Post by mik » Thu, 22 Nov 2001 09:01:53



I want any hit to the following folder to redirect to a new location,
i.e:

www2.domain.com/~    redirects to     www.domain.com/~

! AND changes the browser location to www.domain.com. I tried the
following but to no avail; am I doing something wrong?

<VirtualHost 10.20.30.40>
Servername www2.domain.com
Redirect /doc/root http://www.domain.com
ErrorLog  /doc/logs/error_log
TransferLog  /doc/logs/access_log
ScriptAlias /cgi-bin/  /doc/root/cgi-bin/
</VirtualHost>

Thanks
Mike Dunlop

 
 
 

How do I create an Apache redirect (url)

Post by Andrew Kenn » Thu, 22 Nov 2001 09:57:19


You are after ReWrite Engine.

1) do a httpd -l and see if it lits mod_rewrite in its output, if it doesn't
you will need to re-compile apache with the --enable-module=mod_rewrite
2) Take a look at the manual on http://httpd.apache.org  with regards to
mod_rewrite, its fairly straight forward with some really good examples

got any dramas email me

Andrew


Quote:> I want any hit to the following folder to redirect to a new location,
> i.e:

> www2.domain.com/~    redirects to     www.domain.com/~

> ! AND changes the browser location to www.domain.com. I tried the
> following but to no avail; am I doing something wrong?

> <VirtualHost 10.20.30.40>
> Servername www2.domain.com
> Redirect /doc/root http://www.domain.com
> ErrorLog  /doc/logs/error_log
> TransferLog  /doc/logs/access_log
> ScriptAlias /cgi-bin/  /doc/root/cgi-bin/
> </VirtualHost>

> Thanks
> Mike Dunlop


 
 
 

How do I create an Apache redirect (url)

Post by David Efflan » Fri, 23 Nov 2001 04:52:54



Quote:> I want any hit to the following folder to redirect to a new location,
> i.e:

> www2.domain.com/~    redirects to     www.domain.com/~

> ! AND changes the browser location to www.domain.com. I tried the
> following but to no avail; am I doing something wrong?

><VirtualHost 10.20.30.40>
> Servername www2.domain.com
> Redirect /doc/root http://www.domain.com
> ErrorLog  /doc/logs/error_log
> TransferLog  /doc/logs/access_log
> ScriptAlias /cgi-bin/  /doc/root/cgi-bin/
></VirtualHost>

RTFM: Is /doc/root a "url-path"?  Try:

Redirect / http://www.domain.com/

--
David Efflandt - All spam is ignored - http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/

 
 
 

1. Netscape Commerce Server (Redirecting URLs and URL Aliases)

Hi,

We're using the Netscape Commerce Server, and some of the departments
at our site have complained to our web guy about the lengths of the
URLs they have to use to advertise their pages.  Our web guy wants to
maintain his directory structure and still provide alternate shorter
URL names.

For example:

       www.umuc.edu/department_1.html

                 Would Point To:

       www.umuc.edu/long/path/under/document_root/department_1.html

Being a UNIX guy, my first thought was to put a link in the document
root directory which points to the longer file path.  This almost works,
but since our web guy uses relative addressing for graphics, the
graphics aren't appearing when the page is referenced using the link.

We also tried to use the server's "map a URL to a local directory"
feature, but ended up with the exact same results.

Lastly we tried using the <meta http-equiv="refresh" content=5;url=blah">
thing, but that only works on certain browsers, and we're looking for
a solution that works for all browsers.

Any suggestions are greatly appreciated,
-Rocky
--
Rocky Giannini
UMUC Unix and VMS Systems

2. usb web cam suggestion

3. Redirecting Virtual Host URL to real URL - HOW?

4. swap (/tmp) is getting filled up

5. Redirect URL Apache

6. sed

7. Apache 1.1.1 single URL Redirects

8. How to handle newline character(s) in a TCP server

9. Apache Redirect when %20 is part of the URL - Please help

10. Apache Redirect URL for index page?

11. Apache URL Redirect

12. Getting Apache to not URL encode when redirecting

13. How to redirect server_name to URL in APache?