Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
 All Forums
 General
 Search Engines & Marketing
 SEO friendly URLs Google Search -Solved
Author « Topic »  

stonewx
Starting Member

31 Posts

Pre-sales questions only
(More Details...)

Posted - 10/28/2019 :  09:31:31  
While using the SEO Friendly URLs, I had invalid urls indexing as a valid page in Google Search Console.
My products.php is rewritten to /stone-products/
and my categories.php is rewritten to /stone-category/

The url /stone-products/[any string of text] would resolve to my "all products" - this resulted in thousands of pages being indexed because we had 25 pages of products. So the end result would be that the url /stone-products/[any string of text]?pg=1-25 was being indexed for any string of text.

I ended up testing for a numeric $GLOBALS['catid'] or an empty value to display the incproducts.php and if not, display an error message and throw a 404 error.

Here's the code for the products page:

[code]<?php
if ((is_numeric($GLOBALS['catid'])) || (($GLOBALS['catid'])=='')){
include "[storedir]/inc/incproducts.php";
}
else {
header("HTTP/1.0 404 Not Found");
echo '<p><em>'.$GLOBALS['xxSryNA'];
echo '<p>';
$crosssellaction='bestsellers';
include "[storedir]/inc/inccrosssell.php";
echo '</p>';
}
?>[/code]

This is category page:

[code]if ((is_numeric($GLOBALS['catid'])) || (($GLOBALS['catid'])=='')){
include "vsadmin/inc/inccategories.php";
}
else {
header("HTTP/1.0 404 Not Found");
echo '<p><em>'.$GLOBALS['xxSryNA'];
echo ' Need something else?</em></p>
echo '<p>'
.'New Inventory';
$recommendedcategories=TRUE;
include 'vsadmin/inc/inccategories.php';
echo '</p>';
}[/code]

Includes
[code]
$GLOBALS['detlinkspacechar']='-';
$GLOBALS['seodetailurls']=TRUE;
$GLOBALS['seocategoryurls']=TRUE;
$GLOBALS['seocaturlpattern']='/stone-category/%s';
$GLOBALS['seoprodurlpattern']='/stone-products/%s';
$GLOBALS['seourlsthrow301']=TRUE;
[/code]

.htaccess
[code]
RewriteOptions inherit

RewriteEngine On

<IfModule mod_rewrite.c>

RewriteBase /

RewriteRule ^stone-category/([^/.]*)?$ /categories.php?cat=$1 [QSA,nc,L,B]
RewriteRule ^stone-products/([^/.]*)?$ /products.php?cat=$1 [QSA,nc,L,B]
#RewriteRule ^manufacturer/([^/.]*)/?$ /products.php?man=$1 [QSA,nc,L,B]
RewriteCond $1 !\.(png|gif|jpg|ico|pdf|css|js|php|xml|html|htm)$ [NC]
RewriteRule ^([^/.]+)$ proddetail.php?prod=$1 [QSA,nc,L,B]
</IfModule>
[/code]

Hope this solution helps someone else!

Thank you,
Lynne

Edited by - stonewx on 10/28/2019 21:56:28

Vince
Administrator

42470 Posts

Posted - 10/28/2019 :  10:56:15  
Hi Lynne br / Am I understanding correctly that the $_SERVER[ REQUEST_URI value isn't what you think it should be? If that's the case, have you tried printing out the value to see if it agrees with what you think it should be? Or even, display all the server variables with for instance...

<?php
$allserver=$_SERVER;
ksort($allserver);
foreach($allserver as $key => $value){
print '<div style="width:300px;text-align:right;float:left">' . $key . ' : </div><div> ' . $value . "</div>";
}
?>

Does that help at all? Or am I not getting the right idea?

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000