Author Topic: Troubleshooting SEF: 404, 500, incorrect redirects, and other page errors.  (Read 43492 times)

Forrest

  • Hero Member
  • *****
  • Posts: 1972
  • Me and my baby
    • Web Developer
One of the most popular, repeated questions asked on this forum is in regards to SEF issues causing 404 and 500 page errors.

The first thing to do is identify that this error is in fact due to turning on SEF. Since this thread will be about SEF issues, please verify that your site links in question work fine with SEF off (Disable your Joomla SEF, and or your component SEF).

---------------------------------

1. The most common issue I see is the incorrect usage of VM component links in Joomla menu systems.
Symptoms:
  • 404 page
  • redirects to VM category or product pages
  • other redirect issues

For SEF to work properly, and for Joomla module assignments in VM, you need to have a primary/master link to VM component. When you first set up Virtuemart, you should assign it a menu link in a Joomla Menu.

Typically you may name this link "Shop" or "Store", though you can name it whatever you want to. Make sure you assign it an alias (no spaces, lowercase).

If you have not done this, or did not do this before you created Joomla menu links to category and/or product pages, then you likely will have problems.

Never created a Joomla menu link to VM component: If you never create a link to VM component in Joomla, then VM assigns itself an Itemid of 1. Joomla uses Itemid's to assign modules. In other words, to assign modules, you need to have a menu item to assign it to! Not having a link to VM in Joomla menu system will not give you any control over your modules you may want to assign to VM pages. Likewise, when you turn on SEF, you likely will encounter redirect issues during checkout, since having an itemid is crucial to the redirect process. All you need to do is create a Joomla menu link to the VM component. Do not fill in any of the parameter values for the menu item. You can now turn on your SEF and test again!

I did create a Joomla menu link to VM component: If you have created one or more Joomla menu link(s) to the VM component, then likely you did this before creating a primary/master link to VM component. Essentially Joomla will only use ONE Itemid for Virtuemart component. This Itemid is considered to the the ROOT of your store to Joomla with SEF on. To troubleshoot, you will first need to find WHAT ITEMED is Joomla using as your VM primary/master Itemid.
a. Turn your SEF off.
b. Create a Joomla article page, and enable the Virturemart Module to show on that page, with the "Show All Products" enabled.
c. Click on the "Show All Products" link in module on the article page.
d. In the URL of "Show All Products" you will see an Itemid. This itemid is what Joomla is using as your store root.
e. Go to your Joomla menu Manager and find this id number in your Joomla menus.
f. Take this link and:
  • rename it to "Store" or "Shop" (or whatever your want to signify as your store root)
  • move this link to a Main Level menu item, if it is not already
  • Remove any/all parameters assigned to the VM component menu item (parameters on right of menu item when editing)
  • If this link was a category or product page link, you will need to create a new one.

What you have done is now found your master Itemid for VM, and labeled this as store/shop/etc, and put it on a main/top level in your menu, with no VM parameters assigned.
You should be able to turn back on your SEF and see everything like your categories and products, checkout, etc, are under your Joomla assigned VM root of yoursite.com/store/ or yousite.com/shop/ or similar.


---------------------------------

2. Your template is not developed correctly.
Symptoms:
  • 500 error pages
  • Add to cart button not working with SEF on

While I cannot help you with your template, you can easily find out if it's a template issue. With SEF on, change your Joomla template to a template provided in the Joomla installation package, like BEEZ. If you find that your 500 errors are gone, then it is a template design/architecture issue, and you should contact your template developer.


---------------------------------

3. You are using a 3rd party SEF component.
Symptoms:
  • 500 error pages
  • 404 error pages
  • other redirect issues

I cannot help you at all with 3rd party SEF if these other solutions posted here do not help. You best bet is to contact the SEF developer directly (on their forum or email) for a solution.


---------------------------------

4. Your domain name repeating in URL (dup domains).
Symptoms:
  • 500 error pages
  • domain.comdomain.com/index.php...

You did not put a trailing slash "/" in the URL settings of your VM config. Please make sure both URL and Secure URL settings have a trailing slash. IE: http://www.domain.com/


---------------------------------

5. Lack of www in domain names.
Symptoms:
  • Add to cart button not working SEF on and AJAX.

Set your VM URL settings (in VM admin) to use www in the domain. Likewise, you can use .htaccess to force the use of www on non-www requests.

Add this code at bottom of .htaccess, for both http, https:


###### Added by Forrest to insure AJAX cart works by force of www
#
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS} =on
RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS} !=on
RewriteRule .* http://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
#
########## End - Addition by Forrest


If you want to specify ONE domain or BY domain instead use this:
Note: make sure you repalce "YOURDOMAINHERE" with your domain name without www.

###### Added by Forrest to insure AJAX cart works by force of www
#
RewriteCond %{HTTP_HOST} ^YOURDOMAINHERE\.com
RewriteCond %{HTTPS} =on
RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^YOURDOMAINHERE\.com
RewriteCond %{HTTPS} !=on
RewriteRule .* http://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
#
########## End - Addition by Forrest


---------------------------------

6. .htaccess is not set up correctly when your site is in a sub folder.
Symptoms:
  • Complete lack of functioning site.
  • 404 pages

If you just turned on SEF, and renamed htaccess.txt to .htaccess, then you will want to turn on mod_rewrite and also specify the sub-folder in which your installation sits. To turn them on, just uncomment them (remove "#")

#  mod_rewrite in use
RewriteEngine On

RewriteBase /yoursubfolder


---------------------------------

7. router.php and custom VM hacks
Symptoms:
  • 404 pages
  • redirects to incorrect VM pages

If you are using router.php, and problem 1 in this post did not solve your issue, then you may have a hack installed that the router.php was not designed to handle. Router.php was designed with specific VM pages, native to VM. If you add new functions to VM using hacks, then router.php will not know how to handle these new functions and pages. You will need to modify router.php to support them. Likewise, router.php has a few known issues, like a redirect issue during checkout when adding new shipping addresses, and I believe also with "Ask a Product Question".


---------------------------------


shv_rk

  • Jr. Member
  • **
  • Posts: 68
Hello,
Not sure if it is correct thread for my question/problem!
I have 2 main vm menu item in the joomla main menu. first one which is my main vm store lists all my products and have sub-menus for different categories. all these work fine with and without SEF.

The other VM menu item in the joomla main menu is "manufacturers" which lists all manufacturers. This is template page which i have created myself by adding manufacturer module into it.   
this page lists all manufacturer and clicking on the readmore should show manufacturer details. however, when SEF is turned on it, it redirects to the home page and shows manufacturer details in the home page.
this page is even working fine with SEF on localhost!
below is part of manufacturer page, the rest is exactly like manufacturer module:
Code: [Select]
<div class="manufacturerListTitle">

<?php $manufacturer_link "index.php?option=com_virtuemart&page=shop.browse&manufacturer_id=".$manufacturer->manufacturer_id."&Itemid=3"?>
<h5>

<a href="<?php echo $manufacturer_link ?>">
        <?php echo $manufacturer->mf_name?> </a>
</h5>
</div>
<div class="clear"></div>

<div class="manufacturerShortDescription">
<?php echo $manufacturer->mf_email ?>
</div>
</div>
<div class="manufacturerListRightContainer">
<div class="manufacturerListImage">
<a
href="<?php echo "index.php?option=com_virtuemart&page=shop.browse&manufacturer_id=".$manufacturer->manufacturer_id."&Itemid=3"?>">
<img
src="images/manufacturersImage/<?php echo $manufacturer->manufacturer_id?>.jpg"
alt="<?php echo $manufacturer->mf_name;?>"> </a>

</div>
Any suggestions?
btw: VM pagination does not work properly when joomla SEF is running and even without sh404SEF!

I am using
sh404SEF  version: 1.5.8.432 -
VM: 1.1.4
joomla: 1.5

Forrest

  • Hero Member
  • *****
  • Posts: 1972
  • Me and my baby
    • Web Developer
How about a link to site?

shv_rk

  • Jr. Member
  • **
  • Posts: 68
unfortunately, our website is not published yet, and I do not have permission to do it so before it is running properly!

Forrest

  • Hero Member
  • *****
  • Posts: 1972
  • Me and my baby
    • Web Developer
I would mess with your Itemid=3 in manufacturer source.

shv_rk

  • Jr. Member
  • **
  • Posts: 68
Yeah already tryout that.. no hope!  :-\

shv_rk

  • Jr. Member
  • **
  • Posts: 68
even original manufacturer module does not work fine with sh404sef.
it keep directing to index pagw

Forrest

  • Hero Member
  • *****
  • Posts: 1972
  • Me and my baby
    • Web Developer
Maybe a sh404sef issue? I do not use sh404sef, so I'm not of much help with this.

erick_alcala

  • Jr. Member
  • **
  • Posts: 155
  • Everything is Possible!
    • Ofix-Comp
It would be nice to see a tutorial about setting up SEO/SEF in virtuemart. or is there one already ? :O
wanting to learn to create good templates

joshmayer

  • Beginner
  • *
  • Posts: 1
    • Best Windows Firewall
niche share thanks guys..

Joomla.weblap

  • Beginner
  • *
  • Posts: 6
I draw your attention to it
http://forum.joomla.org.hu/virtuemart-keresooptimalizalas-t12587.html
without sef unique keywords descriptions to the products
Excuse me for the bad English


JoomJohnny5

  • Beginner
  • *
  • Posts: 37
Forrest, we cannot thank you enough. You are the man with the master plan.

Was battling with 404 errors during checkout process for a week, but I found your post and the primary/master link relationship was the problem.

Will pass this on.  Keep rocking good people.
There's only one remedy for mulletosis.

nikosa

  • Beginner
  • *
  • Posts: 3
hello,can sb explain me how this is done

"Create a Joomla article page, and enable the Virturemart Module to show on that page, with the "Show All Products" enabled."

do you mean to create a menu item linked to vm module?and where do i find "show all products"??
thank you

valoran

  • Beginner
  • *
  • Posts: 2
Thank you soo much dude, I tried it and it worked fine. But after a few days I decided it's an overkill to use SEF for my small project, but I still wanted to thank you!

loppan

  • Jr. Member
  • **
  • Posts: 100
    • CRASHDÏET Official Website
  • VirtueMart Version: 3.0.12
hello,can sb explain me how this is done

"Create a Joomla article page, and enable the Virturemart Module to show on that page, with the "Show All Products" enabled."

do you mean to create a menu item linked to vm module?and where do i find "show all products"??
thank you

I did like this :

Created a new article

Created a new menu item (named SEFTEST) pointing to that article

Activated the virtuemart module on that article page (mod_virtuemart_1.1.8.j15)

Now I got the "Show all products" link.

However, I still cannot get it to work. My Checkout link gives error 404.

I have my VM item ID, and I have a link to it in my main joomla menu (Same menu as my "default" page (HOME) are located in).

Any ideas what I could be missing? I did follow Forrest's advice #1 very carefully. His other suggestions does not apply to me.

Truly greatful for some help, as usual :).

Best regards Peter

EDIT :

Here's my checkout URL without SEF on :

mydomain.org/index.php?page=checkout.index&option=com_virtuemart&Itemid=67&redirected=1&Itemid=67

And with SEF :

mydomain.org/store?page=checkout.index&ssl_redirect=1&option=com_virtuemart&Itemid=67

The item ID is there. Everything else except the checkout link works.

Site's URL is http://sister.catchall.stranger.fanzone.org/ . SEF is not activated now.
Joomla 3.4.8 + VM 3.0.12