Jump to content
Stef's Coding Community
fazlionline

Redirect Page Problem

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
i donot know why no one was able to help me
We 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).

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...