phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
Headers sent 301 - Browser won't redirect - [FIXED]

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB SEO TooLKit  » Zero duplicate
::  
Author Message
visio



Joined: 31 May 2007
Posts: 22

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Thu May 31, 2007 7:50 pm    Post subject: Headers sent 301 - Browser won't redirect - [FIXED]

Hi, I installed the zero dup mod, everything seems fine except the old urls won't redirect for me in my browser(IE or FF)

Here are a few old ones:

http://www.1stsearchenginerankings.com/forums/viewtopic.php?t=244
http://www.1stsearchenginerankings.com/forums/viewforum.php?f=3

If I look them up with websniffer it says the headers are sent 301. Check yourself if you like.

But in my browsers it won't redirect me. I user 301s all the time and have no trouble so it isn't that.

Got any ideas?

Also I don't want to stick the link in the global footer. I tried the index.php but it didn't show up. Can you give me an idea how to stick it in the index file so it shows up on the home page only?

Thanks, Randy


Last edited by visio on Wed Jun 06, 2007 5:14 pm; edited 1 time in total
Back to top
SeO
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 15 Mar 2006
Posts: 2383

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Thu May 31, 2007 8:28 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

http://www.1stsearchenginerankings.com/forums/viewtopic.php?t=244
Code:

HTTP Status Code: HTTP/1.1 301 Moved Permanently
Location:   http://1stsearchenginerankings.com/forums/what-is-this-called-t244.html   
Connection:   close   
Transfer-Encoding:   chunked   
Content-Type:   text/html


The target misses the www, so with redirecting to force the www prefix this can loop and fail.
You need to set you phpBB config right eg "www.1stsearchenginerankings.com" for the domain name in acp.

Besides, headers are correct, so it should not be more tricky than this, which is kind of tricky Wink

_________________
Back to top
visio



Joined: 31 May 2007
Posts: 22

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Thu May 31, 2007 11:33 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

Hmm so you mean login to the admin and change the config... I think it is already set the way you said but I will check...

Wait I can't. When i try and login I get this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/search/public_html/forums/index.php:1) in /home/search/public_html/forums/phpbb_seo/phpbb_seo_class.php on line 295

Warning: Cannot modify header information - headers already sent by (output started at /home/search/public_html/forums/index.php:1) in /home/search/public_html/forums/phpbb_seo/phpbb_seo_class.php on line 296

Ohh no. I thought I was done with that. Any ideas what is wrong?

Thanks a million!
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13031

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Fri Jun 01, 2007 9:28 am    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

This is actually the same problem I think, get rid of the www prefix redirection for a minute, and you'll be able to go to ACP, because while you loginto acp, you're redirected to the domain set up in acp as well, thus here without the www prefix which activates the www prefix redirection.

You can as well directly edit the phpbb_config table using phpmyadmin, the sitename value Wink

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
visio



Joined: 31 May 2007
Posts: 22

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Sun Jun 03, 2007 7:50 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

I reset the files and then went into the general config in admin and changed domain name to www.1stsearchenginerankings.com

I then re-uploaded the files and I still get the same error when attempting login. Good news though, the old files do now redirect to the new files. Now I just need to figure out how to fix the login problem which still gives this error:

Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/search/public_html/forums/index.php:1) in /home/search/public_html/forums/phpbb_seo/phpbb_seo_class.php on line 295

Warning: Cannot modify header information - headers already sent by (output started at /home/search/public_html/forums/index.php:1) in /home/search/public_html/forums/phpbb_seo/phpbb_seo_class.php on line 296



Here is my .htaccess file:

Code:
#Options +FollowSymlinks
RewriteEngine On
RewriteBase /

#########################################################
# PHPBB SEO REWRITE RULES #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# FORUM INDEX (un-comment if used)
# RewriteRule ^forums/index\.html$ /forums/index.php [QSA,L,NC]
# FORUM PROTECTION RULE
# RewriteRule ^forums/[a-z0-9_-]*/([^/]+\.html)$ /forums/index.php [R=301,L,NC]
# CATEGORIES
RewriteRule ^forums/[a-z0-9_-]*-c([0-9]+)\.html$ /forums/index.php?c=$1 [QSA,L,NC]
# PAGINATED FORUM
RewriteRule ^forums/[a-z0-9_-]*-f([0-9]+)-([0-9]+)\.html$ /forums/viewforum.php?f=$1&start=$2 [QSA,L,NC]
# FORUM
RewriteRule ^forums/[a-z0-9_-]*-f([0-9]+)\.html$ /forums/viewforum.php?f=$1 [QSA,L,NC]
# PAGINATED TOPIC
RewriteRule ^forums/[a-z0-9_-]*-t([0-9]+)-([0-9]+)\.html$ /forums/viewtopic.php?t=$1&start=$2 [QSA,L,NC]
# TOPIC
RewriteRule ^forums/[a-z0-9_-]*-t([0-9]+)\.html$ /forums/viewtopic.php?t=$1 [QSA,L,NC]
# POST
RewriteRule ^forums/post([0-9]+)\.html$ /forums/viewtopic.php?p=$1 [QSA,L,NC]
#PROFILES
RewriteRule ^forums/member([0-9]+)\.html$ /forums/profile.php?mode=viewprofile&u=$1 [QSA,L,NC]
# END PHPBB PAGES
#####################################################

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.1stsearchenginerankings.com
AuthUserFile /home/search/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/search/public_html/_vti_pvt/service.grp

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^1stsearchenginerankings.com [NC]
RewriteRule ^(.*)$ http://www.1stsearchenginerankings.com/$1 [L,R=301]


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

AddType application/x-httpd-php5 .php



OKAY HERES THE DEAL! Since the admins here seem to give free help I am willing to give one of them $15 via paypal(easy money for someone knowing what they are doing) to take a look at fix the problem for me.

ADDED: What I mean is FTP access so it can be fixed. Please send me a email at randy[at}1st-rankings.com if you will do this for me. It would be a big help!

Thanks for all your help!
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13031

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Sun Jun 03, 2007 9:23 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

First, you should not start mod rewrite more than once.
And the www prefix redirection should be the first one of all.

So find :

Code:
#Options +FollowSymlinks
RewriteEngine On
RewriteBase /


And after add :
Code:
RewriteCond %{HTTP_HOST} ^1stsearchenginerankings.com [NC]
RewriteRule ^(.*)$ http://www.1stsearchenginerankings.com/$1 [L,R=301]


And then delete :
Code:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^1stsearchenginerankings.com [NC]
RewriteRule ^(.*)$ http://www.1stsearchenginerankings.com/$1 [L,R=301]


As well as :
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


Apears two times, and the last occurence of :
Code:
RewriteEngine On
RewriteBase /



Then, about the error you get, it is strange. Could you post here the code you have in phpbb_seo_class.php file, not all of it, just the code around line 295 (+- 10 lines lets say).

If it is the files end, there may be an extra space after the ending php tag : ?>
Make sure there isn't any, but I doubt.

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
visio



Joined: 31 May 2007
Posts: 22

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Sun Jun 03, 2007 10:40 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

phpbb_seo file:

Code:
// --> Zero Duplicate
   /**
   * Custom HTTP 301 redirections.
   * To kill duplicates
   */
   function seo_redirect($url, $header = "301 Moved Permanently", $code = 301, $replace = TRUE) {
      global $db;
      if ( !empty($db) ) {
         $db->sql_close();
      }
      if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r") || strstr(urldecode($url), ';url')) {
         message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
      }
      $http = (@function_exists("getallheaders")) ? "HTTP/1.1 " : "Status: ";
      header($http . $header, $replace, $code);
      header("Location:" . $url);
      exit();
   }
   /**
   * Helps out grabbing boolean vars
   */
   function seo_cond($bool = FALSE, $or = FALSE) {
      if ( $bool || ($this->do_redir && $or) ) {
         $this->do_redir = TRUE;
      }
      return;
   }
   /**
   * Returns the REQUEST_URI
   */
   function seo_req_uri() {
      // Apache mod_rewrite
      if ( isset($_SERVER['REQUEST_URI']) ) {
         return $_SERVER['REQUEST_URI'];
      }
      // IIS  isapi_rewrite
      if ( isset($_SERVER['HTTP_X_REWRITE_URL']) ) {
         return $_SERVER['HTTP_X_REWRITE_URL'];
      }
      // no mod rewrite
      return  $_SERVER['SCRIPT_NAME'] . ( ( isset($_SERVER['QUERY_STRING']) ) ? '?'.$_SERVER['QUERY_STRING'] : "" );
   }

?>



After removing the space from the end of the file I NOW get this error:

Code:
Parse error: syntax error, unexpected '}' in /home/search/public_html/forums/phpbb_seo/phpbb_seo_class.php on line 322
Back to top
SeO
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 15 Mar 2006
Posts: 2383

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Mon Jun 04, 2007 7:06 am    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

Well, it as well looks like you are missing the seo_start() method, look again the last part of the zero dupe install. The last instruction.

As well, dcz mentioned spaces after ?>, no the } before.

_________________
Back to top
visio



Joined: 31 May 2007
Posts: 22

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Mon Jun 04, 2007 3:51 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

I looked over and couldn't find any problems.

I don't know what happened but the urls aren't redirecting anymore either. They give the same error:


Code:
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/search/public_html/forums/phpbb_seo/phpbb_seo_class.php on line 334



This is what my phpbb_seo file looks like now:

Code:
// --> Zero Duplicate
   /**
   * Custom HTTP 301 redirections.
   * To kill duplicates
   */
   function seo_redirect($url, $header = "301 Moved Permanently", $code = 301, $replace = TRUE) {
      global $db;
      if ( !empty($db) ) {
         $db->sql_close();
      }
      if (strstr(urldecode($url), "\n") || strstr(urldecode($url), "\r") || strstr(urldecode($url), ';url')) {
         message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
      }
      $http = (@function_exists("getallheaders")) ? "HTTP/1.1 " : "Status: ";
      //header($http . $header, $replace, $code);
      //header("Location:" . $url);
      exit();
   }
   /**
   * Helps out grabbing boolean vars
   */
   function seo_cond($bool = FALSE, $or = FALSE) {
      if ( $bool || ($this->do_redir && $or) ) {
         $this->do_redir = TRUE;
      }
      return;
   }
   /**
   * Returns the REQUEST_URI
   */
   function seo_req_uri() {
      // Apache mod_rewrite
      if ( isset($_SERVER['REQUEST_URI']) ) {
         return $_SERVER['REQUEST_URI'];
      }
      // IIS  isapi_rewrite
      if ( isset($_SERVER['HTTP_X_REWRITE_URL']) ) {
         return $_SERVER['HTTP_X_REWRITE_URL'];
      }
      // no mod rewrite
      return  $_SERVER['SCRIPT_NAME'] . ( ( isset($_SERVER['QUERY_STRING']) ) ? '?'.$_SERVER['QUERY_STRING'] : "" );
   }
/**
   * check start var consistency
   */
   function seo_start($start = 0, $limit = 0) {
      if ($limit > 0) {
         $start = ( is_int( $start/$limit ) ) ? $start : intval($start/$limit)*$limit;
         $this->start = ( $start > 0  ) ? $this->seo_static['start'] . $start : '';
      } else {
         $this->start = ( $start > 0  ) ? $this->seo_static['start'] . $start : '';
      }
   }
?>



I just can't seem to figure out what is wrong. If I add another T-Function to the end like such: }?> it allows me to view the forums but I can't login and the urls still don't redirect.
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13031

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Mon Jun 04, 2007 6:05 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

SeO wrote:

As well, dcz mentioned spaces after ?>, no the } before.


Replace :

Code:
?>


With :
Code:

}
?>


To start with.

Have you updated your .htaccess as advised ?

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
visio



Joined: 31 May 2007
Posts: 22

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Mon Jun 04, 2007 6:36 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

Okay done... after changing the ?> tag when trying to login it now goes to http://www.1stsearchenginerankings.com/forums/index.php but does not give an error and the forums don't load just the added test I place at the top of the screen to notify users there was a problem with the forums.
If you just browse the forums everything works but you can't login still.

I did update the .htaccess before and it now looks like this:

Code:
#Options +FollowSymlinks
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^1stsearchenginerankings.com [NC]
RewriteRule ^(.*)$ http://www.1stsearchenginerankings.com/$1 [L,R=301]

#########################################################
# PHPBB SEO REWRITE RULES #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# FORUM INDEX (un-comment if used)
# RewriteRule ^forums/index\.html$ /forums/index.php [QSA,L,NC]
# FORUM PROTECTION RULE
# RewriteRule ^forums/[a-z0-9_-]*/([^/]+\.html)$ /forums/index.php [R=301,L,NC]
# CATEGORIES
RewriteRule ^forums/[a-z0-9_-]*-c([0-9]+)\.html$ /forums/index.php?c=$1 [QSA,L,NC]
# PAGINATED FORUM
RewriteRule ^forums/[a-z0-9_-]*-f([0-9]+)-([0-9]+)\.html$ /forums/viewforum.php?f=$1&start=$2 [QSA,L,NC]
# FORUM
RewriteRule ^forums/[a-z0-9_-]*-f([0-9]+)\.html$ /forums/viewforum.php?f=$1 [QSA,L,NC]
# PAGINATED TOPIC
RewriteRule ^forums/[a-z0-9_-]*-t([0-9]+)-([0-9]+)\.html$ /forums/viewtopic.php?t=$1&start=$2 [QSA,L,NC]
# TOPIC
RewriteRule ^forums/[a-z0-9_-]*-t([0-9]+)\.html$ /forums/viewtopic.php?t=$1 [QSA,L,NC]
# POST
RewriteRule ^forums/post([0-9]+)\.html$ /forums/viewtopic.php?p=$1 [QSA,L,NC]
#PROFILES
RewriteRule ^forums/member([0-9]+)\.html$ /forums/profile.php?mode=viewprofile&u=$1 [QSA,L,NC]
# END PHPBB PAGES
#####################################################

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.1stsearchenginerankings.com
AuthUserFile /home/search/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/search/public_html/_vti_pvt/service.grp


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

AddType application/x-httpd-php5 .php
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13031

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Mon Jun 04, 2007 6:55 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

All right, this is not really related to your issue, but still, would be better if you replace :


Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


With:
Code:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


In your .htaccess.

Then, the way thing turns makes it difficult to support, because it as well seems you could have only missed a part of the install.

I suggest you start a test board and start installing first the mod rewrite from scratch, and then, once everything is working, including login, add the zero dupe.

It looks like you have backups of your file just before you started to install mod rewrite and the zero dupe, if the login is working at this stage, redoing it from scratch would probably be really faster than trying to find out about this really strange issue (never saw a login problem with these).

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
visio



Joined: 31 May 2007
Posts: 22

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Mon Jun 04, 2007 7:06 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

Hmm maybe your right.
Back to top
visio



Joined: 31 May 2007
Posts: 22

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Wed Jun 06, 2007 5:12 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

Okay I FIGURED IT OUT!!!!!

Here was the problem. If you have removed sessions before using this mod you can have a problem. That was mine. So I installed a test board and used those files(be careful if you got other mods) and it worked.

I then got this problem where I couldn't login. This was caused by the cookie settings in admin general config. Change cookie domain to:
.domain.com
NO http:// or www prefix just the DOT


So it is all fixed now. Thanks alot!
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13031

Headers sent 301 - Browser won't redirect - [FIXED]Posted: Wed Jun 06, 2007 8:41 pm    Post subject: Re: Headers sent 301 - Browser won't redirect - [FIXED]

Great Very Happy

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB SEO TooLKit  » Zero duplicate
Page 1 of 1

Navigation Similar Topics

Jump to: