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

2

1 Answer 1

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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