Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Independent SEO URL Validation


FWR Media

Recommended Posts

Ultimate SEO Version 2.1.

I do get the 404 when I put the code - die('Show me the 404 big boy!!'); ... :-)

When I just leave the General.php file with the contribution code in that re-directs to index.php I am getting a 302 first ( not a 404) and then 200 (see below) -

#1 Server Response: http://www.xxxxx.net/my-great-product-c-99999.html HTTP/1.1 302 Found

#2 Server Response: http://www.xxxxx.net/ HTTP/1.1 200 OK

Strange,but true.Can't figure why it should do that though.

Thanks,

Chris

 

When I just leave the General.php file with the contribution code in that re-directs to index.php I am getting a 302 first ( not a 404) and then 200 (see below) -

 

Sorry I must be slow today because I'm not understanding this.

 

When I just leave the General.php file with the contribution code in that re-directs to index.php

 

Leave it with what? do you mean the untouched validation function code?

 

Where are you getting a 302? how are you stopping it to read the header?

Link to comment
Share on other sites

  • Replies 382
  • Created
  • Last Reply

Top Posters In This Topic

  • FWR Media

    150

Somebody PLEASE HELP ME!!! I have just discovered my webhost is using ZEUS servers instead of Apache. I’ve no idea how to modify the .htaccess file to make this contribution work with ZEUS. The mod_rewrite is an Apache module. CHEMO, help me please!!!

:'(

Link to comment
Share on other sites

Sorry I'm not clear.... when I add this contribution - copy and paste I am getting these codes with a duff URL. (302 and then 200)

I am not getting a 404 then 200.

Tool I'm using to check is here :

http://www.seoconsultants.com/tools/headers.asp

Other than this issue it works great !

Regards,

Chris

 

Interesting .. I use firefox addon live HTTP headers

 

header("HTTP/1.0 404 Not Found"); Doesn't seem to record

 

header('Status: 404 Not Found');

 

Shows Status: 404 Not Found .. but still HTTP/1.x 302 Found

 

Just found this http://www.webmasterworld.com/forum88/7400.htm

 

Seems to be a common issue.

Edited by FWR Media
Link to comment
Share on other sites

  • 2 weeks later...
Im having an issue with the mod, IM sure its totally me, But when i try to click on any of the catagories,im getting 404 now, i have over 300 items across each catagory so i know there is stuff there,

Site instafinish.com can anyone assist? Thanks,

 

More info please . .what happens if you turn the mod off in admin for example?

Link to comment
Share on other sites

  • 2 weeks later...

Is it possible to modify this contrbution to remove language parameters from seo urls?

 

now I've: product-1-.html product-1-.html?language=en prodotto-1-.html prodotto-1-.html?language=it produkt-1-.html produkt-1-.html?language=de

 

so three are duplicate urls. How to avoid them with this contribution?

I love oscommerce and OS software! I'm not a programmer, I'm only a learning boy and a translator :) I love full contribution packages!

Link to comment
Share on other sites

Is it possible to modify this contrbution to remove language parameters from seo urls?

 

now I've: product-1-.html product-1-.html?language=en prodotto-1-.html prodotto-1-.html?language=it produkt-1-.html produkt-1-.html?language=de

 

so three are duplicate urls. How to avoid them with this contribution?

 

Well they're not duplicate urls.

 

product-1-.html

prodotto-1-.html

produkt-1-.html

Link to comment
Share on other sites

Well they're not duplicate urls.

 

product-1-.html

prodotto-1-.html

produkt-1-.html

 

these are duplicate urls: product-1-.html and product-1-.html?language=it

I love oscommerce and OS software! I'm not a programmer, I'm only a learning boy and a translator :) I love full contribution packages!

Link to comment
Share on other sites

these are duplicate urls: product-1-.html and product-1-.html?language=it

 

 

No they are not and bots recognise querystring as a different url or believe me most forums would be toast.

Link to comment
Share on other sites

No they are not and bots recognise querystring as a different url or believe me most forums would be toast.

 

if as you said that the are recognized as different urls, but they have the same content... they are duplicate content fo SE's

I love oscommerce and OS software! I'm not a programmer, I'm only a learning boy and a translator :) I love full contribution packages!

Link to comment
Share on other sites

if as you said that the are recognized as different urls, but they have the same content... they are duplicate content fo SE's

 

you have two topics for this luckyno please do not duplicate post and this is not an SEO URL issue so please use the other topic.

Link to comment
Share on other sites

Heya FWR Media,

 

Shopping for good contributions is like shopping for a good car. I kicked the tires on your last upload of "Ultimate SEO URLs" and it worked out perfect. It was just as good as it was advertised to be. :)

 

Now I'm here checking out your "Independent SEO URL Validation". Kicking the tires once again.

 

I have read through the posts and only have one question before I add this contribution.

Will it allow error return codes to act the way they should?

Meaning will it allow me to still define my own error pages and not get in the way?

 

I had a huge problem with another contribution called "Search Engine Friendly URL" and it did this silly thing where it went to the index.php rather than allowing a standard error page.

 

Thanks in advance,

Google Junky

Edited by googlejunky
Link to comment
Share on other sites

Hi Robert,

 

I installed first Ultimate SEO 2.1d (the last Version you uploaded) and its works. After that I installed your Independent SEO URL Validation and i did it like

i should. First uploaded the file to catalog, then I called the URL and added the code to application_top.php and the other code to general.php.

 

In the admin menu is now the option to activate your contribution. I did it but it still doesn't work like it should.

 

I have checked all step twice so that i can hopefully say thats not an install problem.

 

Can you please help me to find out what the problem is ???

Which information do you need ?

 

System is:

Linux 2.6.15 with Apache and PHP Version 4.3.10.

 

'./configure' '--prefix=/usr' '--datadir=/usr/share/php' '--mandir=/usr/share/man' '--bindir=/usr/bin' '--libdir=/usr/share' '--includedir=/usr/include' '--sysconfdir=/etc' '--with-_lib=lib' '--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' '--disable-debug' '--enable-inline-optimization' '--enable-memory-limit' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sigchild' '--disable-ctype' '--disable-session' '--without-mysql' '--disable-cli' '--without-pear' '--with-openssl' '--with-apxs2=/usr/sbin/apxs2-prefork' 'i586-suse-linux'

 

Server API Apache 2.0 Handler

Virtual Directory Support disabled

Configuration File (php.ini) Path /etc/php.ini

PHP API 20020918

PHP Extension 20020429

Zend Extension 20021010

Debug Build no

Thread Safety disabled

Registered PHP Streams php, http, ftp, https, ftps, compress.zlib, compress.bzip2

 

register_globals are on.

 

Loaded Modules core prefork http_core mod_so mod_access mod_actions mod_alias mod_auth mod_auth_dbm mod_autoindex mod_cgi mod_dir mod_env mod_expires mod_include mod_log_config mod_mime mod_negotiation mod_setenvif mod_ssl mod_suexec mod_userdir sapi_apache2 mod_rewrite mod_mono

 

Thanks !!!

Thomas

Link to comment
Share on other sites

Hey my Problem is solved !!!

 

I did something wrong.

 

 

include(DIR_WS_CLASSES . 'language.php');

 

// Ultimate SEO URLs v2.1

include_once(DIR_WS_CLASSES . 'seo.class.php');

if ( !is_object($seo_urls) ){

$seo_urls = new SEO_URL($languages_id);

}

################################################

// fwrmedia.co.uk mod to check SEO link validity

if ( is_object($seo_urls) && (strpos($_SERVER['REQUEST_URI'], '.html') !== false) && (defined('FWR_VALIDATION_ON') && FWR_VALIDATION_ON === 'true') ) { // SEO URLS is active and there is .html in the querystring

tep_validate_seo_urls();

}

################################################

// END fwrmedia.co.uk mod to check SEO link validity

 

$lng = new language();

 

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {

$lng->set_language($HTTP_GET_VARS['language']);

} else {

$lng->get_browser_language();

}

 

$language = $lng->language['directory'];

$languages_id = $lng->language['id'];

}

 

// include the language translations

require(DIR_WS_LANGUAGES . $language . '.php');

 

 

 

 

 

 

But this is right:

 

include(DIR_WS_CLASSES . 'language.php');

 

$lng = new language();

 

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {

$lng->set_language($HTTP_GET_VARS['language']);

} else {

$lng->get_browser_language();

}

 

$language = $lng->language['directory'];

$languages_id = $lng->language['id'];

}

 

// include the language translations

require(DIR_WS_LANGUAGES . $language . '.php');

 

// Ultimate SEO URLs v2.1

include_once(DIR_WS_CLASSES . 'seo.class.php');

if ( !is_object($seo_urls) ){

$seo_urls = new SEO_URL($languages_id);

}

################################################

// fwrmedia.co.uk mod to check SEO link validity

if ( is_object($seo_urls) && (strpos($_SERVER['REQUEST_URI'], '.html') !== false) && (defined('FWR_VALIDATION_ON') && FWR_VALIDATION_ON === 'true') ) { // SEO URLS is active and there is .html in the querystring

tep_validate_seo_urls();

}

################################################

// END fwrmedia.co.uk mod to check SEO link validity

 

 

Greetings

Thomas

Link to comment
Share on other sites

Heya FWR Media,

 

Shopping for good contributions is like shopping for a good car. I kicked the tires on your last upload of "Ultimate SEO URLs" and it worked out perfect. It was just as good as it was advertised to be. :)

 

Now I'm here checking out your "Independent SEO URL Validation". Kicking the tires once again.

 

I have read through the posts and only have one question before I add this contribution.

Will it allow error return codes to act the way they should?

Meaning will it allow me to still define my own error pages and not get in the way?

 

I had a huge problem with another contribution called "Search Engine Friendly URL" and it did this silly thing where it went to the index.php rather than allowing a standard error page.

 

Thanks in advance,

Google Junky

 

The 301 redirect works fine, if you want to test it add the live http headers addon to your firefox browser.

 

In the validation code where it redirects 404 NOT FOUND I would now suggest that you either die(); or redirect to your 404 page.

 

Something like ..

die(
header("HTTP/1.0 404 Not Found"); // Set header 404 Not Found
echo 'This page can not be found - 404 NOT FOUND<p />
<a href="' . tep_href_link(FILENAME_DEFAULT) . '" title="Return to ' . STORE_NAME . '">To return to ' . STORE_NAME . ' please click this link</a>');
exit;

 

The reasons for this is that although the 404 redirect functions perfectly, once redirected to index.php Google/friends see a 302.

Edited by FWR Media
Link to comment
Share on other sites

Your fix worked perfectly. Thanks.

 

 

I do have another question and then I think I won't be bothering you any longer with questions.

 

 

An url as in(which would be the correct one)

http://www.domain.com/my-product-here-p-430.html'>http://www.domain.com/my-product-here-p-430.html

 

if changed to add an extra character to be

http://www.domain.com/my-product-here-pd-430.html

 

I get the error

Warning: constant() [function.constant]: Couldn't find constant in /home/user/public_html/includes/functions/general.php on line 1351


Error!

Unable to determine the page link!

 

 

Yes, I realize that I broke it on purpose. I wanted to rule out any possibility of a server path showing on the screen.

Just a security measure I would like to take. I would have assumed that any error in the url of this type would return a 404 or something of that nature.

 

I know I'm asking for a lot here, but is there any way to get this turned into a 404 error?

 

 

Note: To anyone else reading this. This isn't a problem with the contribution. I'm asking for something special.

 

Thanks,

Google Junky

Link to comment
Share on other sites

Your fix worked perfectly. Thanks.

I do have another question and then I think I won't be bothering you any longer with questions.

An url as in(which would be the correct one)

http://www.domain.com/my-product-here-p-430.html'>http://www.domain.com/my-product-here-p-430.html

 

if changed to add an extra character to be

http://www.domain.com/my-product-here-pd-430.html

 

I get the error

Warning: constant() [function.constant]: Couldn't find constant in /home/user/public_html/includes/functions/general.php on line 1351
Error!

Unable to determine the page link!

Yes, I realize that I broke it on purpose. I wanted to rule out any possibility of a server path showing on the screen.

Just a security measure I would like to take. I would have assumed that any error in the url of this type would return a 404 or something of that nature.

 

I know I'm asking for a lot here, but is there any way to get this turned into a 404 error?

Note: To anyone else reading this. This isn't a problem with the contribution. I'm asking for something special.

 

Thanks,

Google Junky

 

Well firstly it shouldn't happen, there is no RewriteRule for pd in .htaccess so it should fail with a 404 right there.

 

You must have some other rule in there that opens up oscommerce even though the rule doesn't exist.

 

Anyway try this

 

add right at the top of the big strpos above // If -x- is in the querystring

 

$fwr_notfound = false;

 

At the end of the big strpos

 

Change

 

false )))))))))) );

 

To ..

 

 

$fwr_notfound = true )))))))))) );
if ($fwr_notfound)
die(
header("HTTP/1.0 404 Not Found") . ' This page can not be found - 404 NOT FOUND<p />
<a href="' . tep_href_link(FILENAME_DEFAULT) . '" title="Return to ' . STORE_NAME . '">To return to ' . STORE_NAME . ' please click this link</a>');

 

See if that works, but I can't test it as all of my sites running this reject it at server level.

Link to comment
Share on other sites

Current .htaccess

 

ErrorDocument 400 /errorpage.php?error=400
ErrorDocument 401 /errorpage.php?error=401
ErrorDocument 403 /errorpage.php?error=403
ErrorDocument 404 /errorpage.php?error=404
ErrorDocument 500 /errorpage.php?error=500

Options All -Indexes
Options +FollowSymLinks
RewriteEngine On 
RewriteBase /
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-([0-9]+).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}

 

The code you offered in the last post worked exactly the way it was supposed to. Thanks again.

 

In this instance before the code you offered, I really don't know why it wasn't going to my standard 404 page either, since I do have it set to do this in .htaccess

 

I know I also hate dealing with workarounds for something that is supposed to work in the first place. My osCommerce is very close to a stock install and yet it is possible that I have overlooked something somewhere.

 

It is a shame that I was unable to get it to just revert to my errorpage.php as the 404 page when this error occurs rather than printing to the screen.

 

If you do know of a solution to skip printing to the screen and instead having it send to my errorpage.php then that would be great. I'm just trying to keep my custom error page as the main one instead of having more than one.

 

You have been a huge help and I thank you again.

Keep up the great work.

 

 

 

 

LAST SECOND EDIT: Please advise

if ($fwr_notfound)
die(
header("Refresh: 0; url=/errorpage.php", false, 404));

Do you see any problem with using this?

Page that is being accessed as wrong url is shown as error code 404. <-- that 's good

When redirected to errorpage.php it has errorpage.php as 200 <-- do you think this is a problem?

 

 

Google Junky

Edited by googlejunky
Link to comment
Share on other sites

Current .htaccess

 

ErrorDocument 400 /errorpage.php?error=400
ErrorDocument 401 /errorpage.php?error=401
ErrorDocument 403 /errorpage.php?error=403
ErrorDocument 404 /errorpage.php?error=404
ErrorDocument 500 /errorpage.php?error=500

Options All -Indexes
Options +FollowSymLinks
RewriteEngine On 
RewriteBase /
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-([0-9]+).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}

 

The code you offered in the last post worked exactly the way it was supposed to. Thanks again.

 

In this instance before the code you offered, I really don't know why it wasn't going to my standard 404 page either, since I do have it set to do this in .htaccess

 

I know I also hate dealing with workarounds for something that is supposed to work in the first place. My osCommerce is very close to a stock install and yet it is possible that I have overlooked something somewhere.

 

It is a shame that I was unable to get it to just revert to my errorpage.php as the 404 page when this error occurs rather than printing to the screen.

 

If you do know of a solution to skip printing to the screen and instead having it send to my errorpage.php then that would be great. I'm just trying to keep my custom error page as the main one instead of having more than one.

 

You have been a huge help and I thank you again.

Keep up the great work.

LAST SECOND EDIT: Please advise

if ($fwr_notfound)
die(
header("Refresh: 0; url=/errorpage.php", false, 404));

Do you see any problem with using this?

Page that is being accessed as wrong url is shown as error code 404. <-- that 's good

When redirected to errorpage.php it has errorpage.php as 200 <-- do you think this is a problem?

Google Junky

 

errorpage.php needs a 404 header. Google will see the 200 not the 404. It seems to be a problem that all the bots have.

Link to comment
Share on other sites

errorpage.php needs a 404 header. Google will see the 200 not the 404. It seems to be a problem that all the bots have.

Would this help ?

Find this code in product_info.php:

CODE

$product_check = tep_db_fetch_array($product_check_query);

 

and add this just after it:

CODE

// Return 404 Not Found for non-existing products

if ($product_check['total'] < 1) header("HTTP/1.0 404 Not Found");

Link to comment
Share on other sites

Hi,

 

I have been having the "too many redirects" issue for the last 2 months and haven't managed to fix it.

 

I have found your "Independant Validation" fix which I have installed it but I still get warnings in Webmaster.

 

I have reset the SEO URL cache and disabled the automatic redirects but nothing works.

 

Here is my SEO set up:

 

Enable SEO URLs? true

Add cPath to product URLs? false

Add category parent to begining of URLs? true

Filter Short Words 3

Output W3C valid URLs (parameter string)? true

Enable SEO cache to save queries? true

Enable product cache? true

Enable categories cache? true

Enable manufacturers cache? true

Enable articles cache? true

Enable topics cache? true

Enable information cache? true

Enable link directory cache? true

Enable automatic redirects? false

Choose URL Rewrite Type Rewrite

Enter special character conversions é=>e,è=>e,ê=>e,ô=>o,û=>u,à=>a,ç=>c,œ=>oe

Remove all non-alphanumeric characters? false

Reset SEO URLs Cache false

 

I believe I have the v2.2e by Jack.

 

I don't know what else to do now.

 

Should I install v2.1d instead?

Link to comment
Share on other sites

Hi,

 

I have been having the "too many redirects" issue for the last 2 months and haven't managed to fix it.

 

I have found your "Independant Validation" fix which I have installed it but I still get warnings in Webmaster.

 

I have reset the SEO URL cache and disabled the automatic redirects but nothing works.

 

Here is my SEO set up:

I believe I have the v2.2e by Jack.

 

I don't know what else to do now.

 

Should I install v2.1d instead?

 

Try installing 2.1d, I don't support 2.2.2e

Link to comment
Share on other sites

Try installing 2.1d, I don't support 2.2.2e

 

Hi,

 

I installed 2.1d but I still got the "too many redirects" problem and also I lost the SEO urls for my links which was a big issue for my links exchange, so I reverted back to 2.2.2e. I have read somewhere the too many redirects can be caused by a wrong htaccess configuration. Maybe Jack can help...

 

Thanks for your reply anyway.

 

Best regards,

 

Florence

Link to comment
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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...