How set up a redirect for all "not found" pages?

Discuss webmaster issues, website development and resources. Ask questions about website building, coding, SEP/SEO etc here. NO ADS!

Moderators: magnetize, Oosha, ftello, shezz

How set up a redirect for all "not found" pages?

Postby Jeff99 » Sun Jan 10, 2010 11:57 pm

I would like to cover all bases in terms of any "not found" pages on my site. Ideally, any such pages would be redirected to the home page. Is this possible without knowing which pages they are? One way is in the .htaccess file, like this perhaps?

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteRule \/.+ / [L,R]



Or can I do it via cPanel somehow? I have heard G. doesn't like "not found" pages and therefore want to make sure any and all pages are redirected to the home page in such cases.

Thanks for your help!
Cheers,
Jeff
User avatar
Jeff99
 
Posts: 168
Joined: Sun May 17, 2009 12:20 pm
Location: Asia

Re: How set up a redirect for all "not found" pages?

Postby Jeff99 » Mon Jan 11, 2010 5:00 am

Can I also use the redirection plugin or .htaccess to make the 302 into a 301? How would this work?

Isn't it better to intercept the commands in .htaccess first?

One other idea:

Can I simply make a custom error page and put a html redirect in it to the home page?
Cheers,
Jeff
User avatar
Jeff99
 
Posts: 168
Joined: Sun May 17, 2009 12:20 pm
Location: Asia


Return to Web Development Resources

Who is online

Users browsing this forum: No registered users and 1 guest

cron