Magento 2 - URL rewrites - check if target path exists in URL rewrite managementHow to get URL rewrite Target Path programmaticallyURL Rewrite Management problem with rewritesCase Sensitive URL RewritesHow can i bulk ADD URL Rewrite ManagementURL Rewrite Rules in Adminset default page to Particular store viewHow to do redirect the URL of siteMagento 1.9.3.6 duplicated url rewrites after each reindexHow to find if target path in custom url rewrite exists in magento 2Magento 2.2.5 URL Rewrites - Duplicate entry 'myurl' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID'
What happens if there is no space for entry stamp in the passport for US visa?
Cine footage fron Saturn V launch's
Why are road bikes (not time trial bikes) used in many triathlons?
Is this artwork (used in a video game) real?
Using two linked programs, output ordinal numbers up to n
How Can I Process Untrusted Data Sources Securely?
How to delete certain lists from a nested list?
A scene of Jimmy diversity
What advantages do focused Arrows of Slaying have over more generic ones?
Cauchy reals and Dedekind reals satisfy "the same mathematical theorems"
Can a dragon's breath weapon pass through Leomund's Tiny Hut?
Do I need a 50/60Hz notch filter for battery powered devices?
What happens on Day 6?
How to remove the first colon ':' from a timestamp?
Alternator dying so junk car?
Is straight-up writing someone's opinions telling?
Intel 8080-based home computers
What impact would a dragon the size of Asia have on the environment?
Is it insecure to not let a user choose their own username, and base the username on a known pattern?
Mechanical puzzle ID: Ring, barbell, and four-holed panel
Finding the package which provides a given command
When to ask for constructive criticism?
Why is Katakana not pronounced Katagana?
Credit card details stolen every 1-2 years. What am I doing wrong?
Magento 2 - URL rewrites - check if target path exists in URL rewrite management
How to get URL rewrite Target Path programmaticallyURL Rewrite Management problem with rewritesCase Sensitive URL RewritesHow can i bulk ADD URL Rewrite ManagementURL Rewrite Rules in Adminset default page to Particular store viewHow to do redirect the URL of siteMagento 1.9.3.6 duplicated url rewrites after each reindexHow to find if target path in custom url rewrite exists in magento 2Magento 2.2.5 URL Rewrites - Duplicate entry 'myurl' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID'
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to redirect my customers when a 404 page is thrown. To achieve this, I need to check whether a particular target path exists in the url rewrite management table.
For example : if my target path is "category1/category2/product1", how would I check that this target path is present in the url rewrite management table, and how to retrieve all information / entries matching the target path shown above ?
magento2 magento-2.1 url-rewrite
add a comment |
I need to redirect my customers when a 404 page is thrown. To achieve this, I need to check whether a particular target path exists in the url rewrite management table.
For example : if my target path is "category1/category2/product1", how would I check that this target path is present in the url rewrite management table, and how to retrieve all information / entries matching the target path shown above ?
magento2 magento-2.1 url-rewrite
add a comment |
I need to redirect my customers when a 404 page is thrown. To achieve this, I need to check whether a particular target path exists in the url rewrite management table.
For example : if my target path is "category1/category2/product1", how would I check that this target path is present in the url rewrite management table, and how to retrieve all information / entries matching the target path shown above ?
magento2 magento-2.1 url-rewrite
I need to redirect my customers when a 404 page is thrown. To achieve this, I need to check whether a particular target path exists in the url rewrite management table.
For example : if my target path is "category1/category2/product1", how would I check that this target path is present in the url rewrite management table, and how to retrieve all information / entries matching the target path shown above ?
magento2 magento-2.1 url-rewrite
magento2 magento-2.1 url-rewrite
asked Mar 31 '17 at 9:56
Thomas DominguesThomas Domingues
1722 silver badges14 bronze badges
1722 silver badges14 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
/**
* @var MagentoUrlRewriteModelUrlRewrite
*/
protected $_urlRewrite;
public function __construct(
MagentoUrlRewriteModelUrlRewrite $urlRewrite
)
$this->_urlRewrite = $urlRewrite;
$this->_urlRewrite->getCollection()->addFieldToFilter('target_path', 'category1/category2/product1')
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f167114%2fmagento-2-url-rewrites-check-if-target-path-exists-in-url-rewrite-management%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
/**
* @var MagentoUrlRewriteModelUrlRewrite
*/
protected $_urlRewrite;
public function __construct(
MagentoUrlRewriteModelUrlRewrite $urlRewrite
)
$this->_urlRewrite = $urlRewrite;
$this->_urlRewrite->getCollection()->addFieldToFilter('target_path', 'category1/category2/product1')
add a comment |
/**
* @var MagentoUrlRewriteModelUrlRewrite
*/
protected $_urlRewrite;
public function __construct(
MagentoUrlRewriteModelUrlRewrite $urlRewrite
)
$this->_urlRewrite = $urlRewrite;
$this->_urlRewrite->getCollection()->addFieldToFilter('target_path', 'category1/category2/product1')
add a comment |
/**
* @var MagentoUrlRewriteModelUrlRewrite
*/
protected $_urlRewrite;
public function __construct(
MagentoUrlRewriteModelUrlRewrite $urlRewrite
)
$this->_urlRewrite = $urlRewrite;
$this->_urlRewrite->getCollection()->addFieldToFilter('target_path', 'category1/category2/product1')
/**
* @var MagentoUrlRewriteModelUrlRewrite
*/
protected $_urlRewrite;
public function __construct(
MagentoUrlRewriteModelUrlRewrite $urlRewrite
)
$this->_urlRewrite = $urlRewrite;
$this->_urlRewrite->getCollection()->addFieldToFilter('target_path', 'category1/category2/product1')
answered Feb 26 '18 at 15:20
rexrex
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f167114%2fmagento-2-url-rewrites-check-if-target-path-exists-in-url-rewrite-management%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown