Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Created my own way to fix SEO URL issue…. 
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

I coded my own method and now the product pages always point to the original URL...there still might be some bugs, but i will fix that (if any).

let me know if im right: http://www.dogbedmall.com/magento/dog-beds/extra-small-dog-beds

most of the items on this site are in 5 or more different categories, but the product pages all point to the orignal URL.

Any thoughts would be great..

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

found a bug...hmmmmmm...almost there ill figure it out...i was so excited sorry folks…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

FIXED! I think it works perfect now!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

I told the script to always re-direct to the original URL, so no matter now many items u add to whatever amount of categories it will always go to the original url of the product.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

new url is http://www.dogbedmall.com/shop

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

nice work...any plans to share the changes with the peanut gallery?

 
Magento Community Magento Community
Magento Community
Magento Community
 
NickL
Sr. Member
 
Avatar
Total Posts:  188
Joined:  2007-08-31
 

I’m also curious...as I’m moving into some SEO work.  Post your methods if you can Conyx. Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

You only need to edit “list.phtml" inside “catalog” > “product” folder

edit the bold href(link) part, which is the image link (note: theis is not the modified line):

<a href=”<?php echo $_product->getProductUrl() ?>” title="<?php echo $this->htmlEscape($_product->getName()) ?>">

edit the bold href(link) part, which is the product link (note: theis is not the modified line):

<a href=”<?php echo $_product->getProductUrl() ?>” title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName())?></a>

If you guys cant solve it PM me, im pointing you in the right direction so you should be able to solve it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michal_s
Sr. Member
 
Total Posts:  111
Joined:  2008-05-15
The Netherlands
 

i to would like this mod, let me know if you are going to share it with us smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

NOTE: The code I posted doesn’t fix the problem, I stated somewhere in the post that this is not the code fix, but the spot you modify to fix the url issue (thats were I made my modification and it works).

I am going to release the code, but once it’s determined its the best approach.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dustin
Sr. Member
 
Total Posts:  160
Joined:  2008-03-13
Columbus, OH
 
Conyx Group - 15 May 2008 09:47 AM

You only need to edit “list.phtml" inside “catalog” > “product” folder

edit the bold href(link) part, which is the image link (note: theis is not the modified line):

<a href=”<?php echo $_product->getProductUrl() ?>” title="<?php echo $this->htmlEscape($_product->getName()) ?>">

edit the bold href(link) part, which is the product link (note: theis is not the modified line):

<a href=”<?php echo $_product->getProductUrl() ?>” title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName())?></a>

If you guys cant solve it PM me, im pointing you in the right direction so you should be able to solve it.

Here is what I did to get this to work.

The place he has bolded I replaced with this:

<?php echo $this->getBaseUrl() . $_product->getUrlKey() . '.html' ?>

I know there is a field in the db that stores the url key with the .html on the end, but I have not figured out how to make a call to get that yet, but this works great for me for now.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

had the same approach but as you notice you have to cheat the system with the .html inclusion (which works so its fine), but i do think there is a more efficient way (cleaner I should say).

But get job on figuring it out!!!! Wasnt so hard at all!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conyx Group
Member
 
Total Posts:  66
Joined:  2008-03-19
 

I mean great* on figuring it out!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
bloggleme
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-05-06
 

This is pretty limited. There are tons of files and pages that may link to your product. Make sure you go through all of your pages to replace the old code with the new.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ronny Lange
Jr. Member
 
Total Posts:  18
Joined:  2008-02-03
Munich
 

Yes you are right - cause of the internal link structure you also have to replace the code in upsell.phtml, crossell.phtl and related.phtml.

How are you dealing with the main category - is it the first one the product linked to? I didn’t see any possibility to assign a main category.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bloggleme
Sr. Member
 
Avatar
Total Posts:  101
Joined:  2008-05-06
 

They are not dealing with the main category at all. The way they are doing it is basically disabling category rewrites all together. You do not have http://www.yoursite.com/maincategory/product.html - its just http://www.yoursite.com/product.html

Also, I went deep into one of the Url.php files (handles rewrites) and found the getProductUrl function. That function is called any time you link to a product, so you can simply change that function.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2