Solved: How to Remove SID (SESSION_ID) from URL in Magento 2?

The SID is a “session ID”. Magento uses this to track a user’s activity within the same Magento installation. Normally, Magento powers one website and one store from one installation (database).

Magento could power multiple websites with multiple stores from one installation though. The SID allows users to stay logged in while navigating across these websites/stores.

I think if you have the function enabled, the SID is sent when accessing catalog URLs so Magento can update the session with the user’s location/state for the current website/store.

If you’re not running a multi-website or multi-store environment, it’s safe to disable the SID on the frontend.

To disable SID from the storefront go to:

  1. Magento dashboard > Store > Configuration > General > Web > Session Validation Settings > Use SID on Storefrontand set its value to No.
  2. Re-index Magento
  3. Refresh Magento cache

If the SID is still present in the URL then the next step is to make server level change in your root htaccess file:

The solution is simple. Go to your .htaccess fine and find the line that says

RewriteEngine on 

If you want to have www part:

RewriteEngine on 
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

If you don’t want to have www part:

RewriteEngine on 
RewriteCond %{HTTP_HOST} !^yourdomain\.com$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

Do you know a better solution? Leave a comment and let me know.

Solved: How to fix required parameter ‘theme_dir’ was not passed?

Why does this happen?

This error is normally returned when you remove your Magento theme directly from app/design or vendor/ directory. Removing theme files directly from the directory is not a Magento standard way anymore. Magento 2 has a CLI command to remove themes safely i.e.

Command usage:

magento theme:uninstall [--backup-code] [-c|--clear-static-content] {theme path} ... {theme path}
  • {theme path} is the relative path to the theme, starting with the area name. For example, the path to the Blank theme supplied with Magento 2 is frontend/Magento/blank.
  • --backup-code backs up the Magento 2 codebase as discussed in the paragraphs that follow.
  • --clear-static-content cleans generated static view files, which is necessary to cause static view files to display properly.


STEP 1 : File Operations

  • Delete the content from app/design/frontend/<Vendor>.
  • Delete all the content of folder var/view_preprocessed & pub/static/frontend.

STEP 2 : DB Operations

Go to your theme table and delete the entry for your created theme.

After that…

Go to your core_config_data table and search for theme and you will get path records like design/theme/theme_id replace your default theme id in it. You can run the following command in PHPMyadmin or your database CLI.

SELECT * FROM `core_config_data` WHERE `path` LIKE '%design/theme/theme_id%'

STEP 3 : Flush cache

Flush your cache php bin/magento cache:flush

Solved: Top Navigation is missing in Magento 2 when Varnish is activated

Steps to reproduce

  • Put store in maitenance mode
  • Install Magento 2.1 either from CLI or zip upload
  • run setup:upgrade and setup:di:compile commands
  • Navigate to front end

Expected result

Store page displays normally with catalog navigation for both HTTP and HTTPS requests

Actual result

Store page displays the navigation menu with HTTP request only. It doesn’t work for HTTPS



Configure store URL and Varnish on HTTPS so all incoming requests are served securely. Make sure that you update your nginx configuration from fastcgi_param HTTPS $fastcgi_https; to fastcgi_param HTTPS “on”.