Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Redirects on Apache web server htaccess

Posted on 2008-06-20
2
Medium Priority
?
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

721 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