fazlionline Posted May 10, 2009 Report Posted May 10, 2009 Hello all I have a link on my site for a blog. when that page opens it have a redirect script for a blog in other website but when i clik on blog linke the page opens but do not redirect to other page and give this error: Warning: Cannot modify header information - headers already sent by (output started at d:\Customers\user1092190\www\v2\blog\blog.php:9) in d:\Customers\user1092190\www\v2\blog\blog.php on line 10 my script is this <?php header( 'Location: http://www.fazlionline.com/wordpress/' ) ; ?> note: i have past this script in the main body tag is there any rule to put the redirect in a special place? Thanks Quote
Andrea Posted May 10, 2009 Report Posted May 10, 2009 I'm a little confused - you have a link on your site that links to a page that then redirects? Why not just update the link and link to where your blog really is? Alternatively, if you want to keep using the outdated site, there are 301 redirects - but those belong in the head section. Quote
fazlionline Posted May 10, 2009 Author Report Posted May 10, 2009 (edited) Dear Thelma Please see http://www.fazlionline.com/ But my blog is http://www.fazlionline.com/wordpress/ So I want the user to be redirected from ?blog? folder to ?wordpress? folder Edited May 10, 2009 by fazlionline Quote
Andrea Posted May 10, 2009 Report Posted May 10, 2009 That error you get has nothing to do with the redirect, but with the page at fazlionline.com/blog/blog.php. Again: Why do you not just fix the link so it points to the wordpress blog? Or google 301 redirects? Quote
fazlionline Posted May 10, 2009 Author Report Posted May 10, 2009 i can link this page directly to blog but i want to learn the redirect script. Quote
virtual Posted May 10, 2009 Report Posted May 10, 2009 301 redirect scripts" htt p://ww w.webconfs.com/how-to-redirect-a-webpage.php Quote
LSW Posted May 11, 2009 Report Posted May 11, 2009 Redirect scripts should not be used if not needed (Here it is not needed). Spammers have used redirect scripts for years to redirect your from some clean page to a page with porn all viruses etc., Redirect pages can actually hurt your SEO ratings. Not to mention it is rather unfriendly to the user and especially special needs users. Learn it when/if you need it. Always use the right tool for the job... this is rarely one of them. In my 10 years of web development I have never needed a redirect script for anything, as mentioned just correct the links. Quote
fazlionline Posted May 12, 2009 Author Report Posted May 12, 2009 Thanks to all The redirect may be useless but I tried to learn how it works. I have finally found this on Google search? It is very simple to redirect a page from one to other. i donot know why no one was able to help me Just past the code before everything on page, even before , do not leave even a blank line; put it on the most top. The code is: <?php header( 'Location: http://www.fazlionline.com/wordpress/' ) ; ?> Thanks Quote
jlhaslip Posted May 12, 2009 Report Posted May 12, 2009 The best method for a redirect like this is to either have Cpanel create the Redirect or make an .htaccess file on the Root directory for the redirect. The Cpanel method actually just writes the redirect for you. How to implement the 301 Redirect 1. To create a .htaccess file, open notepad, name and save the file as .htaccess (there is no extension). 2. If you already have a .htaccess file on your server, download it to your desktop for editing. 3. Place this code in your .htaccess file: redirect 301 /old/old.htm http://www.you.com/new.htm'>http://www.you.com/new.htm 4. If the .htaccess file already has lines of code in it, skip a line, then add the above code. 5. Save the .htaccess file 6. Upload this file to the root folder of your server. 7. Test it by typing in the old address to the page you've changed. You should be immediately taken to the new location. Notes: Don't add "http://www" to the first part of the statement - place the path from the top level of your site to the page. Also ensure that you leave a single space between these elements: redirect 301 (the instruction that the page has moved) /old/old.htm (the original folder path and file name) http://www.you.com/new.htm (new path and file name) from : isitebuild.com/301-redirect.htm Quote
fazlionline Posted May 12, 2009 Author Report Posted May 12, 2009 Thanks jlhaslip i will work on it too Quote
Andrea Posted May 12, 2009 Report Posted May 12, 2009 i donot know why no one was able to help meWe did - I told you to google 301 redirects* (twice) and virtual even gave you a link. And LSW gave you same background information. What did you want? Someone to write it for you? * and I had it half wrong - the last 301 redirects I did were to redirect jsp pages - now THOSE go to the top of the page (before the , even), most others go into the .htaccess file like (like jlhaslip mentioned). Quote
fazlionline Posted May 12, 2009 Author Report Posted May 12, 2009 Thanks EveryOne I have solved my problem Thanks Again Quote
zamshed Posted June 17, 2009 Report Posted June 17, 2009 And in place of that you may use JavaScript to redirect as follows, echo ""; regards Zamshed Farhan Quote
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.
Note: Your post will require moderator approval before it will be visible.