JTapp Posted May 22, 2008 Share Posted May 22, 2008 Does anybody know how I can make all old, dead webpages forward directly to my index.hml page? Instead of getting the "Page Not Found" error message? Thanks for your time. Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/ Share on other sites More sharing options...
Xurion Posted May 22, 2008 Share Posted May 22, 2008 What was the extension of the pages you want to redirect? .html? .php? And what is your web server? Apache? Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-547496 Share on other sites More sharing options...
JTapp Posted May 22, 2008 Author Share Posted May 22, 2008 I was hoping for a 'catch all'. But there are two addresses out there that are dead and they are .html I'm running Apache.. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-547506 Share on other sites More sharing options...
soycharliente Posted May 22, 2008 Share Posted May 22, 2008 Is it because it appears on Google and the pages don't exist? Maybe a header redirect with PHP and/or HTML meta tag to stop caching. Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-547619 Share on other sites More sharing options...
haku Posted May 23, 2008 Share Posted May 23, 2008 This article should help you. Do it for 404 redirects as well, not just 301. http://www.vanseodesign.com/blog/seo/301-redirects-for-improved-seo/ Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-547806 Share on other sites More sharing options...
dbrimlow Posted May 26, 2008 Share Posted May 26, 2008 The easiest way is to put them in your htaccess file as follows: Redirect 301 /myoldpage.php http://www.mydomain.com/index.php Redirect 301 /anotherpage.html http://www.mydomain.com/index.php Redirect 301 /the oldestpage.php http://www.mydomain.com/index.php It really is as easy as that. Just remember that it is absolutely crucial to save your .htaccess and FTP it as ASCI and not binary. Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-550361 Share on other sites More sharing options...
Xurion Posted May 27, 2008 Share Posted May 27, 2008 Doesn't .htaccess only work on apache? Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-550629 Share on other sites More sharing options...
haku Posted May 27, 2008 Share Posted May 27, 2008 That's correct. Most people are on apache servers though. The OP didn't say which he was on. Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-550779 Share on other sites More sharing options...
Xurion Posted May 27, 2008 Share Posted May 27, 2008 I know someone who was wanting to do a similar thing to .htaccess but isn't on an apache server. Do you know of an alternate? Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-550955 Share on other sites More sharing options...
dbrimlow Posted May 27, 2008 Share Posted May 27, 2008 What server are they using? What do they want to redirect? URL, old page to new page? Are on windows server 2008? Windows 2003 IIS? .net? Do they use .asp pages? Here are a few solutions depending upon the type: IIS Redirect * In internet services manager, right click on the file or folder you wish to redirect * Select the radio titled "a redirection to a URL". * Enter the redirection page * Check "The exact url entered above" and the "A permanent redirection for this resource" * Click on 'Apply' ColdFusion Redirect <.cfheader statuscode="301" statustext="Moved permanently"> <.cfheader name="Location" value="http://www.new-url.com"> ASP Redirect <%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www.new-url.com/" %> ASP .NET Redirect <script runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.new-url.com"); } </script> Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-551132 Share on other sites More sharing options...
Xurion Posted May 28, 2008 Share Posted May 28, 2008 Old pages are HTML but new pages are PHP. Not sure what server type but it isn't Apache. Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-551654 Share on other sites More sharing options...
dbrimlow Posted May 28, 2008 Share Posted May 28, 2008 Old pages are HTML but new pages are PHP. Not sure what server type but it isn't Apache. Well, if he uses php then it isn't Windows, either. There are dozens of web servers that php works with. If he has access to the config.php file he can add something like: if (isset($_SERVER['HTTPS']) && $_SERVER['HTTP'] == "on") { header("Status: 301 Moved Permanently", false, 301); header("location: https://www.hiswebsite.com/index.html"); } else { header("Status: 301 Moved Permanently", false, 301); header("location: http://www.hiswebsite.com/index.html"); } Although that's bulky for individual pages. I'm sure there is an easier way. I suppose he needs a regex Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-551811 Share on other sites More sharing options...
Xurion Posted May 28, 2008 Share Posted May 28, 2008 He is running WIndows with PHP :/ Quote Link to comment https://forums.phpfreaks.com/topic/106804-redirect-old-dead-webpages-to-home-page/#findComment-551920 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.