Author Topic: Advice on url structure after site redesign  (Read 3559 times)

batetim

  • Beginner
  • *
  • Posts: 8
Advice on url structure after site redesign
« on: February 22, 2022, 10:53:15 am »
Morning all,

I wonder if anyone could lend some advice on a dilemma we have on a site redesign which uses a new template and home page set up.

We are using Joomla! 3.10.6, vm 3.8.8.  Yootheme 2.7.16, VMuikit 10.9.

We have moved from a site design which had virtuemart as the home page so our url structure was simple. i.e

www.oursite.co.uk/examplecategory.html (for categories)

www.oursite.co.uk/exampleproduct-details.html (for products)

In our new site design, to allow us to design our homepage with all info required (i.e using the yootheme builder) we have had to create a menu item to associate the virtuemart category layout to.

This now means all our urls have changed to :

www.oursite.co.uk/MENUSLUG/examplecategory.html (for categories)

www.oursite.co.uk/MENUSLUG/exampleproduct-details.html (for products)

This gives us a problem in that we have about 3,500 already indexed category and product pages that will now 404.

I have been trying to find a solution, but i am wary of using a seo extension to create redirects because of the sheer number and what that would do to the site.

Is anyone able to lend any advice on how we could make these links work without the /MENUSLUG/ part of the new url structure so our already indexed pages would continue to work?

Kind regards

Tim

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4675
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Advice on url structure after site redesign
« Reply #1 on: February 22, 2022, 11:32:42 am »
If you have not to many categories, you can add the redirection directly
for products, you can modify the suffix in the vm config to"detail" and check for "details' to redirect old links correctly

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1620
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Advice on url structure after site redesign
« Reply #2 on: February 22, 2022, 14:54:12 pm »
This operation must be prepared before deploy new version (big mistake.. wonder after deploy is wonder for me everytime if I see others work) ach :(

So we put redirect in httacess manually from export old sitemaps to excel. So many hours :)
yes we use sometimes * or $ for group of redirects and we use loading redirects.txt file to httacess.

But after this we fight with canonical links, and then we use Jmap
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

batetim

  • Beginner
  • *
  • Posts: 8
Re: Advice on url structure after site redesign
« Reply #3 on: February 24, 2022, 18:09:33 pm »
Many thanks S42 and pinochico. I really appreciate your advice.

Looking at our vm category and product redirects needed, i have identified about 3500 needed in a spreadsheet as suggested.

I wonder is there an issue putting this many rules in the .htaccess file? is that likely to affect site speed and performance? (i could ask our host siteground to put these server side perhaps if this is a more efficient solution)

I understand the ability to modify the suffix in the vm config to "detail", but I am not very experienced in redirect rules, what would the code/rule look like to address this using the example earlier?

Kind regards

Tim

sirius

  • Jr. Member
  • **
  • Posts: 187
    • OCTeam
  • VirtueMart Version: 3.8.6
Re: Advice on url structure after site redesign
« Reply #4 on: February 25, 2022, 10:11:58 am »
Hi
first, look in your .htaccess and find this:
Code: [Select]
RewriteEngine On remove the # in front if needed

Then find this:
Code: [Select]
## Begin - Custom redirectsAnd add those below just after

for the "detail" you can start with this:
Code: [Select]
RewriteRule ^(.*)-details\.html$ /$1.html [R=302,L]
Then check the results, once all is fine change to:
Code: [Select]
RewriteRule ^(.*)-details\.html$ /$1.html [R=301,L]
(302 tell the bot that this is temporary, 301 that's permanent)

For the "/MENUSLUG/examplecategory.html" if the old link (/examplecategory.html) is not naturally generated by the website, so you're facing an alias, the natural way should be to redirect the old link to the new one.
So as Pinochico said, you must first check if the canonical link is really like "/MENUSLUG/examplecategory.html" before making any choice.

But to redirect the categories in one way or another you can use:
Code: [Select]
RewriteRule ^MENUSLUG\/(.*)\.html /$1 [QSA,L,R=301]other way
Code: [Select]
RewriteRule ^(.*)\.html /MENUSLUG/$1.html [QSA,L,R=301]
To do some tests you can look at the network dev console of your browser or use this one:
https://www.redirection-web.net/
J3.10.11 | PHP 7.4.33 + APC + memcached + Opcode
VM Prod : 3.8.6 | VM Test : 4.0.12.10777

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4675
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Advice on url structure after site redesign
« Reply #5 on: February 26, 2022, 11:09:47 am »
Please check here https://gist.github.com/ScottPhillips/1721489
You should find the rules you need

batetim

  • Beginner
  • *
  • Posts: 8
Re: Advice on url structure after site redesign
« Reply #6 on: February 28, 2022, 16:02:49 pm »
much appreciated, thankyou all for your advice!

batetim

  • Beginner
  • *
  • Posts: 8
Re: Advice on url structure after site redesign
« Reply #7 on: March 08, 2022, 12:09:10 pm »
Hi all,

Appreciate your advice to date.

I have researched the info provided, but have to date not had any luck generating a rule to target the vm product links which are identified ending "-details.html"

VM category pages are small enough in number to tackle by individual rewrite rules, so it is just the product pages i am left with.

I have removed the duplicates by understanding canonicals better now, but that leaves me with over 3000 product pages to change which i have identified from existing sitemap.

If i try to apply individual rewrite rules in the .htaccess for each page such as:

Redirect 301 /Rectangular-Mobile-Folding-Dining-Canteen-Bench-Unit-3080x685x1400-Blue-Top-details.html http://timb114.sg-host.com/shop/Rectangular-Mobile-Folding-Dining-Canteen-Bench-Unit-3080x685x1400-Blue-Top-details.html

Then the website crashes.

I have tried suggested rule:

RewriteRule ^(.*)-details\.html$ /$1.html [R=302,L]

but i am afraid this does not work in my case. I have also checked those examples on https://gist.github.com/ScottPhillips/1721489 but couldn't find one that matched my needs.

Would anyone have an alternative rule i could use or alternatively be interested in helping us with this as paid freelance work as we lack the coding knowledge to write for ourselves.

Kind regards

Tim

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10693
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: Advice on url structure after site redesign
« Reply #8 on: March 08, 2022, 14:55:40 pm »
Redirect 301 /Rectangular-Mobile-Folding-Dining-Canteen-Bench-Unit-3080x685x1400-Blue-Top-details.html http://timb114.sg-host.com/shop/Rectangular-Mobile-Folding-Dining-Canteen-Bench-Unit-3080x685x1400-Blue-Top-details.html
redirects to itself
try
Redirect 301 /Rectangular-Mobile-Folding-Dining-Canteen-Bench-Unit-3080x685x1400-Blue-Top-details.html http://timb114.sg-host.com/shop/Rectangular-Mobile-Folding-Dining-Canteen-Bench-Unit-3080x685x1400-Blue-Top.html

are you sure you have an Apache server? 

if it's Lightspeed you will need

RewriteRule ^/Rectangular-Mobile-Folding-Dining-Canteen-Bench-Unit-3080x685x1400-Blue-Top-details.html http://timb114.sg-host.com/shop/Rectangular-Mobile-Folding-Dining-Canteen-Bench-Unit-3080x685x1400-Blue-Top.html [L,R=301]
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

batetim

  • Beginner
  • *
  • Posts: 8
Re: Advice on url structure after site redesign
« Reply #9 on: March 08, 2022, 15:32:39 pm »
apologies, i had removed that rule when testing something else. This is now redirecting.

The issue i have is that this rule will work, but when i put 3000+ of these rules in the .htaccess file, it becomes too much and website fails.

I was hoping it would be possible to identify the "-details.html" part of the incoming product link to redirect to format:

http://timb114.sg-host.com/shop/rest-of-url-detail.html instead of http://timb114.sg-host.com/rest-of-url-detail.html

This is a workaround for the new menu item alias (shop) that we have had to link virtuemart to as above forum post.

It sounds like it may be possible, i just lack the knowledge and code skills to do it!! :)

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4675
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Advice on url structure after site redesign
« Reply #10 on: March 09, 2022, 09:12:28 am »
You have to check with not begin /shop and end with details
RewriteCond %{REQUEST_URI} !^/shop/(.+)\details.html$
RewriteRule ^(.*)$ $1detail.html [NC,L]
I do  not know the exact rule and i'm not sure this is the right

batetim

  • Beginner
  • *
  • Posts: 8
Re: Advice on url structure after site redesign
« Reply #11 on: March 16, 2022, 14:43:53 pm »
Thanks for the advice from everyone, much appreciated.

Unfortunately we have not been able to resolve and have posted the request on the VM commercial jobs board.

https://forum.virtuemart.net/index.php?topic=148034.0