PDA

View Full Version : Bad Link Re-Direct


entrecon
8-9-06, 12:37 PM
If somone clicks on a link to my site (say www.mysite.com/oldpage.htm) and the page does not exist, they get a page not found error. How can I change this so they go to the index page?

I converted some html sites to PHP, but the html files are still listed out there in places such as search engines and I don't want to have a bunch of HTML files out there with refreshes to the PHP file.

extras
8-9-06, 03:02 PM
You can put a meta tag redirect (with several seconds delay to let 'em know that the URL doesn't exist) in the 404 eror page, with the ErorDocument directive in .htaccess.

Example:
ErrorDocument 404 /e404.html

There are several other methods, as well.

(jj)
8-9-06, 03:10 PM
You can use an .htaccess file with this:

RedirectPermanent /page.html http://www.domain.com/page.php
RedirectPermanent /folder/page2.html http://www.domain.com/page2.php

You would need to have each file listed on a seperate line.

entrecon
8-10-06, 09:53 AM
The 404 error page is exactly what I was looking for. My last host had a control panel option that set this for me.

Thanks for the help!

joshuamc
8-10-06, 09:58 AM
The 404 error page is exactly what I was looking for. My last host had a control panel option that set this for me.

Thanks for the help!
We also have this in our control panel.

OPS>Services>SiteTools>.htaccess>Custom Error Pages

entrecon
8-10-06, 02:36 PM
Yup, that is where I found it!

I was headed in to make the edit and saw it. The other host had one that was similar to your Hotlink option where it was written out in text.

I have been on PowWeb for only a few days now and am liking the interface, for the most part.

I am putting several domains on my account and have been a little disappointed in the way it is handled, but I can live with it for the difference in cost.