bluewaves Posted July 10, 2010 Share Posted July 10, 2010 How do I set up a redirect? I have some pages on my site that have two pages with essentially the same stuff on it. I really should do a redirect on one of them. If people have bookmarked that url, will the redirect to the other page work without any harm? I also have some html pages that I'd like to redirect to .php extensions. I don't want to suffer any Google penalties for it though. Does anyone feel confident in directing me? Thanks! Quote Link to comment Share on other sites More sharing options...
XeNoMoRpH1030 Posted July 12, 2010 Share Posted July 12, 2010 The only HTML option is to use a meta refresh. <meta http-equiv="refresh" content="0;url=http://example.com/" /> There are of course other methods if you rather not use HTML, such as server side and Javascript. Quote Link to comment Share on other sites More sharing options...
haku Posted July 12, 2010 Share Posted July 12, 2010 .htaccess redirects Quote Link to comment Share on other sites More sharing options...
TeddyKiller Posted July 12, 2010 Share Posted July 12, 2010 Use this function for redirects. You can call it via.. redirect("location.php"); This means you can use it anywhere. As it also uses a header if it hasn't been sent, else a js version/meta version. function redirect($location) { if(!headers_sent()) : header('Location: ' . $location); else : echo '<script type="text/javascript">window.location.href="' . $location . '";</script>'; echo '<noscript><meta http-equiv="refresh" content="0;url=' . $location . '" /></noscript>'; endif; } Though for redirecting .html pages to .php, this would work for ALL .html pages in .HTACCESS Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)\.html$ $1.php [NC] Even for your first question, this can be used Redirect 301 /oldpage.php http://www.example.com/newpage.php Quote Link to comment 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.