Are you new? Read the FAQ and catch up on!
874 views

Redirections using htaccess file

It is possible to create redirections using the .htaccess file:

Requests to http://myserver/service/foo.txt will be told to access http://foo2.bar.com/service/foo.txt instead.

Apache configuration
  1. # Redirect single file
  2. Redirect 301 /service http://foo2.bar.com/service
  3.  

­

Redirect all GIF files to like-named JPEG files on another server:

Apache configuration
  1. # Redirect several files
  2. RedirectMatch 301 (.*)\.gif$ http://www.anotherserver.com$1.jpg
  3.  

­

Also, you can use other HTTP statuses instead of 301 with this directives. More info on Redirect and RedirectMatch directves.

Tags: Apache Configuration .htaccess redirections

Embed: