Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Redirects on Apache web server htaccess

Posted on 2008-06-20
2
Medium Priority
?
208 Views
Last Modified: 2010-03-04
Hi

Can anyone advise the best way to:

1. Set up redirects when deploying a new website can you set up a htaccess file to redirect to a page moved or not found, or do you just redirect all to a custom error page?

2. Set up custom error docs (i currently use httaccess file to redirect to chosen error page))

Many thanks

--s--
0
Comment
Question by:socross
2 Comments
 
LVL 11

Accepted Solution

by:
asafadis earned 1000 total points
ID: 21832119
I hope this helps:
# Site has permanently moved to new domain
# domain.com to domain2.com
RewriteCond   %{HTTP_HOST}   ^www.domain.com$   [NC]
RewriteRule   ^(.*)$   http://www.domain2.com/$1   [R=301,L]
 
 
# Page has moved temporarily
# domain.com/page.html to domain.com/new_page.html
RewriteRule   ^page.html$   new_page.html   [R,NC,L]
 
 
# Custom error messages
# 400	Bad Requeststrange stuff with your URL or scripts.
# 401	Authorization Required
# 403	Forbidden
# 404	Not Found
# 500	Internal Server Error
ErrorDocument 404 /NotFound.html

Open in new window

0
 
LVL 1

Author Comment

by:socross
ID: 21923189
Perfect

Thanks

-s-
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question