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
Forum Search
Google Site Search
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Solved: manufacturers.php with SEO friendly URL's
Author « Topic »  

ITZAP
Ecommerce Template Guru

Australia
1022 Posts

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

Posted - 01/18/2022 :  17:53:17  
Running Ecommerce Plus PHP v7.4.6

My question relates to [url="https://www.ecommercetemplates.com/help/manufacturers.asp"][blue]setting up a manufacturers.php page[/blue][/url] with custom <title>, <meta name="Description">, <h1>custom heading</h1> and <p>custom description</p>

Making this work using Vanilla URL's is very easy. And renaming the manufacturers page to [maroon]brands.php[/maroon] works fine as well.



But when you activate the [url="https://www.ecommercetemplates.com/seo/search-engine-friendly-urls-php.asp"][blue]Search engine friendly URL's[/blue][/url] I just cannot get the Redirect to either [maroon]manufacturers.php[/maroon] or [maroon]brands.php[/maroon] to work at all.

What happens is the Redirect goes to [purple]categories.php?man=all[/purple] regardless. Sure, that does list all Manufacturers/Brands. But I want to display the [maroon]brands.php[/maroon] page with custom <title>, description, <h1>heading and description.

Yes, I have followed the instructions. Here is my configuration.

[purple]includes.php[/purple]

[font=Courier New][orange]// ==>> SEO FRIENDLY EXTENSIONLESS URLs v6.4[/orange]
$seodetailurls=TRUE;
$seocategoryurls=TRUE;
$detlinkspacechar='-'; [orange]// For proddetail.php 'Has Static URL' filename, use dashes to separate words entered[/orange]
$urlfillerchar='-'; [orange]// For proddetail.php page, use-dashes-to-separate-words in Product Name[/orange]
$seocaturlpattern="/category/%s"; [orange]// category.php page URL pattern[/orange]
$seoprodurlpattern="/pages/%s"; [orange]// products.php page URL pattern[/orange]
$seomanufacturerpattern="/brand/%s"; [orange]// Product Attribute Group Name 'Brand' URL pattern[/orange]
$seourlsthrow301=TRUE; [orange]// Enable this when SEO URLs are working to generate HTTP 301 Moved Permanently error advice for Search Engines[/orange][/font=Courier New]

[font=Courier New][orange]// MANUFACTURER rename to Brand[/orange]
$manufacturerpageurl="brands.php?man=all";
$xxManuf='Brands'; [orange]// Appears in Breadcrumb link on products.php listing[/orange]
$manufacturerfield="Manufacturer"; [orange]// (optional) Show Manufacturer field info on the proddetail.php page (I think this is Obsolete)[/orange]
$GLOBALS['xxManLab']='Brand'; [orange]// Change label from default Manufacturer[/orange][/font=Courier New]

[purple].htaccess[/purple]

[font=Courier New]<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Search Engine Friendly Extensionless URL's
RewriteRule ^category/([^/.]*)/?$ /categories.php?cat=$1 [QSA,nc,L,B]
RewriteRule ^pages/([^/.]*)/?$ /products.php?cat=$1 [QSA,nc,L,B]
[red]RewriteRule ^brand/?$ /brands.php?man=all [QSA,nc,L,B][/red]
RewriteRule ^brand/([^/.]*)/?$ /products.php?man=$1 [QSA,nc,L,B]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) proddetail.php?prod=$1 [QSA,nc,L,B]
</IfModule>[/font=Courier New]

Any advice about why the [red]brand RewriteRule[/red] does not work would be very much appreciated.

Gary
[img]https://itzap.com.au/pics/logo/itzap-website-design-works-mini-logo.png[/img]

Edited by - ITZAP on 01/20/2022 21:05:07

Vince
Administrator

43206 Posts

Posted - 01/19/2022 :  01:24:03  
Hi Gary
This is what works for me, but if this doesn't help then please let me know and I'll dig deeper...

includes.php

// ==>> SEO FRIENDLY EXTENSIONLESS URLs v6.4
$seodetailurls=TRUE;
$seocategoryurls=TRUE;
$detlinkspacechar='-'; // For proddetail.php 'Has Static URL' filename, use dashes to separate words entered
$urlfillerchar='-'; // For proddetail.php page, use-dashes-to-separate-words in Product Name
$seocaturlpattern="/category/%s"; // category.php page URL pattern
$seoprodurlpattern="/pages/%s"; // products.php page URL pattern
$seomanufacturerpattern="/brand/%s"; // Product Attribute Group Name 'Brand' URL pattern
$seourlsthrow301=TRUE; // Enable this when SEO URLs are working to generate HTTP 301 Moved Permanently error advice for Search Engines

// MANUFACTURER rename to Brand
$manufacturerpageurl="brand/";
$xxManuf='Brands'; // Appears in Breadcrumb link on products.php listing
$manufacturerfield="Manufacturer"; // (optional) Show Manufacturer field info on the proddetail.php page (I think this is Obsolete)
$GLOBALS['xxManLab']='Brand'; // Change label from default Manufacturer

.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Search Engine Friendly Extensionless URL's
RewriteRule ^category/([^/.]*)/?$ /categories.php?cat=$1 [QSA,nc,L,B]
RewriteRule ^pages/([^/.]*)/?$ /products.php?cat=$1 [QSA,nc,L,B]
RewriteRule ^brand/?$ /categories.php?man=all [QSA,nc,L,B]
RewriteRule ^brand/([^/.]*)/?$ /products.php?man=$1 [QSA,nc,L,B]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) proddetail.php?prod=$1 [QSA,nc,L,B]
</IfModule>

And you don't actually need the physical "brands.php" page as it's all done by URL rewriting to the categories.php and products.php pages.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

ITZAP
Ecommerce Template Guru

Australia
1022 Posts

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

Posted - 01/19/2022 :  17:22:13  
Hi Vince, thanks for the reply.
I tried your settings and they produce exactly the same result as mine.[quote]you don't actually need the physical "brands.php" page as it's all done by URL rewriting to the categories.php and products.php pages.[/quote][font=Courier New][red]RewriteRule ^brand/?$ /categories.php?man=all [QSA,nc,L,B][/red][/font=Courier New]

The result here is the list of Menu Categories and the list of Manufacturers both appear with identical <title>, <h1> heading and short description.[quote]My question relates to [url="https://www.ecommercetemplates.com/help/manufacturers.asp"][blue]setting up a manufacturers.php page[/blue][/url] with custom <title>, <meta name="Description">, <h1>custom heading</h1> and <p>custom description</p>[/quote]At the present time the answer is no, you cannot do this if using the search engine friendly URL's, which is a pity.

So perhaps this belongs in the Suggestion Forum.

I believe that the better solution would be to look into altering the URL RewriteRule to Redirect to a [maroon]manufacturers.php[/maroon] (or [maroon]brands.php[/maroon]) page. This way webmasters can present a unique page <title>, <h1> heading and short description to visitors and the search engines, like this ...


[code][font=Courier New][navy]<head>
<title>Leading Brands available from ABC Computers Pty Ltd</title>
<meta property="og:title" content="Leading Brands available from ABC Computers Pty Ltd">

<meta name="Description" content="ABC Computers stock all leading brands of computer gear and IT components. Here you can browse our product range according to manufacturer.">
<meta property="og:description" content="ABC Computers stock all leading brands of computer gear and IT components. Here you can browse our product range according to manufacturer.">
</head>

<body>
<h1>Leading Brands available from ABC Computers Pty Ltd</h1>
<p>ABC Computers stock all leading brands of computer gear and IT components. Here you can browse our product range according to manufacturer.</p>
<?php include "vsadmin/inc/inccategories.php" ?>
</body>[/navy][/font=Courier New][/code]
And when the visitor clicks on a manufacturer, [maroon]products.php[/maroon] takes over and presents that Manufacturer <h1> heading, description and page list as usual.

Regards,

Gary
[img]https://itzap.com.au/pics/logo/itzap-website-design-works-mini-logo.png[/img]

Edited by - ITZAP on 01/19/2022 17:33:49

Vince
Administrator

43206 Posts

Posted - 01/20/2022 :  01:35:28  
Hi Gary
Ok, my apologies and I missed the point there a bit. But can't you do a bit of jiggery pokery with the title. Just a for instance...

<title><?php
if(getget('man')=='all')
print 'your all manufacturers title';
else
print 'Leading Brands available from ABC Computers Pty Ltd'; ?></title>

The metainfo.php script will automatically detect that the page is a manufacturer page and populate $sectionname and $sectiondescription anyway, but you can interrogate the query string to see what parameters are in it if you want to fine tune.

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

ITZAP
Ecommerce Template Guru

Australia
1022 Posts

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

Posted - 01/20/2022 :  20:21:36  
Wowee, that works a treat Thanks so much Vince !

[navy]categories.php[/navy]


[font=Courier New][code]<head>
<title><?php
if(getget('man')=='all') {print $rootmanufacturertitle;}
else if(!empty($pagetitle)) {print $pagetitle;}
else if(!empty($sectionname)) {print $sectionname . ' | ' . $sitename;}
else {print $rootcategorytitle;} ?></title>

<meta name="Description" content="<?php
if(getget('man')=='all') {print $rootmanufacturerdescription;}
else if(!empty($sectiondescription)) {print str_replace('"','"',$sectiondescription);}
else {print $rootcategorydescription;} ?>">
</head>

<body>
<h1><?php
if(getget('man')=='all') {print $rootmanufacturertitle;}
else if(!empty($pagetitle)) {print $pagetitle;}
else if(!empty($sectionname)) {print $sectionname;}
else {print $rootcategorytitle;} ?></h1>

<?php include_once ( $_SERVER["DOCUMENT_ROOT"] . "/vsadmin/inc/inccategories.php") ?>
</body>[/code][/font=Courier New]


That makes [navy]manufacturers.php[/navy] (or [navy]brands.php[/navy]) obsolete. A very clever solution. Thanks again

Gary
[img]https://itzap.com.au/pics/logo/itzap-website-design-works-mini-logo.png[/img]

Vince
Administrator

43206 Posts

Posted - 01/21/2022 :  01:13:49  
  « 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