1

Magento 2 custom module i am trying to add query param https://test.com/index?id=L_FRR3039-ODKLWG-GP4QPY

if i give above format getting 404 page not found

https://test.com/index?id=L_FRR3039

it working fine even https://test.com/index?id=L_FRR3039-ODKLWG_GP4QPY this is also working

it is not taking

-

multiple hyphens remaining all special characters taking can anyone help me in this

1

Please try this,

Add this in your custom controller contructor.

public function __construct(Context $context,\Magento\Framework\App\Request\Http $request){
        $this->request = $request;
        parent::__construct($context);
    }

public function getIddata()
    {
    // use 
        $this->request->getParams(); // all params
        return $this->request->getParam('id');
    }

You can get the param using this $this->getIddata(); in you controller file.

  • it helped for my issue – Pawankumar Apr 3 at 14:17
  • If this helped means please accept the answer. It'll helpful for others – Jeeva Chezhiyan Apr 3 at 14:17
  • accepted already – Pawankumar Apr 3 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.