Questions tagged [url]
Denotes question about URL issues and custom URLs.
966
questions
68
votes
13
answers
177k
views
How to get Magento 2 base URL?
In Magento 1 Mage::getBaseUrl();, but in Magento 2 I have to pass responsible class object type in constructor.
I don’t have the idea which class I have to pass?
30
votes
5
answers
24k
views
Different storeviews or websites in subfolders
A client wants his multistore shop to be set up like this:
http://www.domain1.org/de/ -> website 1, store view 1
http://www.domain1.org/en/ -> website 1, store view 2
http://www.domain1.ch/de/ -> ...
28
votes
5
answers
55k
views
Get Current URL from a PHTML - Magento 2
I'm struggling trying to show the current URL from a PHTML in Magento 2.
Any suggestion?
27
votes
4
answers
34k
views
Efficient get product url from id
What is the most efficient way of getting a product url given just it's ID? In a few places in our code we have things such as Mage::getModel('catalog/product')->load($id)->getProductUrl() in ...
27
votes
3
answers
62k
views
Correct way to change the magento 1.9 admin url
Correct way to change the Magento 1.9 admin url
anyone can provide me the correct way. I see a lot of different suggestion online.
27
votes
1
answer
111k
views
Mage::getBaseUrl() vs Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB)
Is there a reason to use Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) rather than Mage::getBaseUrl()? I've seen both in use, and they both return the same thing. Is the longer one redundant? ...
26
votes
13
answers
74k
views
Remove /index.php from the Magento URL gives 404 error
I am using Magento ver. 1.7.0.2.
Here it is the link to my website: http://dev.blokeundees.com.au/
I have to remove the /index.php folder from URLs so I edited the .htaccess file and backend too (...
24
votes
7
answers
45k
views
How to change magento2 admin url?
Once the installation is completed, is there a posibility to change admin url? If yes how can I do that?
21
votes
2
answers
25k
views
Magento 2: Product URL Suffix
How do I remove the .html suffix from the product pages?
19
votes
5
answers
30k
views
How to remove SID (session ID) from URL in Magento 2
How to remove the session ID from the URL in Magento 2 (frontend). This is the SID query parameter in the URL.
For example: https://example.com/contact/?SID=sfl317buq8ru4uf4a...
Removed starting ...
18
votes
7
answers
71k
views
Magento2 - Get category URL by ID
I'm trying to get the URL key of any given category with the ID. I have this;
$categoryId = 3;
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$object_manager = $_objectManager-...
16
votes
3
answers
40k
views
add query parameters to an existing url string
In Magento if I have a URL string, is there any built in function that I can use to add query parameters to it?
In the exact case I am looking at I am generating a category URL and then I want to add ...
16
votes
2
answers
71k
views
$_product->getProductUrl() giving url path without URL key
I am getting a product collection of a certain category on a page in a few different Magento sites. My code for getting the collection is:
$category = new Mage_Catalog_Model_Category();
...
16
votes
4
answers
17k
views
Magento 2 WYSIWYG Media image directive using admin url
Why is magento 2 creating directives for media images using the admin url?
for example when i add an image on category page WYSIWYG it adds
<img src="{{media url="wysiwyg/image.jpg"}}" alt="" /&...
16
votes
3
answers
18k
views
Magento 2 : get rewrite product url
I am trying to get rewrite product url from the load product in custom module. I am getting url in http://localhost/m2/catalog/product/view/id/1401/category/23/ format .
But I want http://localhost/...
14
votes
2
answers
25k
views
Equivalent of the CMS Directive {{media url="..."}} in Normal Block Templates
What is the equivalent of {{media url="wysiwyg/image.jpg"}} which can be used in CMS pages if we want to use this in a normal .phtml file (of the type core/template)
13
votes
3
answers
44k
views
How to use getUrl() function in Magento 2
Can I call Mage::getUrl() directly using $this-> in Magento2?
How can I use below code in Magento2?
$link = Mage::getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true, '_query'=>$...
13
votes
5
answers
13k
views
404 on Store Switch with Product Store View Scoped URL Key
By default URL Key on product page is Global scoped.
EDIT:
As suggested by FlorinelChis the scope can be changes in Manage attributes.
However this breaks the store view switcher behavior.
This is ...
13
votes
1
answer
983
views
Product URL with additional parameters (CE 1.8 & EE 1.13)
In short: Retrieving a product URL with additional params doesn't work in CE 1.8 & EE 1.13.
URLs have changed with the latest version of Magento. Previously in CE 1.7 and EE 1.12 calling $this-&...
12
votes
5
answers
13k
views
Magento 2: Remove Store Code in URL only for default store
We run a magento 2 multistore in 2 langauges where default store view is german. Online shop is also available in french. Store code is added to URLs like the following:
www.domain.at
www.domain.at/...
11
votes
3
answers
4k
views
MAGE_DIRS bootstrap parameters in CLI
In pub/index.php, the following code is used to set change URLs for media and static assets to omit "/pub":
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [
DirectoryList::PUB => [...
11
votes
1
answer
4k
views
How do I make my custom module pages use SSL?
I've created a Module with some pages and I'm wondering how do I force this pages to use SSL on the url, like the customer login page. Not all of the pages need it, but some do.
What comes to mind (...
10
votes
3
answers
14k
views
why magento product url duplicating
I am using magento 1.7. i am faceing strange problem. magento making duplicate product url with random number with wrong url key please my attached screenshot
I also empty table rewrite_urls and ...
9
votes
2
answers
14k
views
How to redirect to previous page in admin?
In my admin controller action I want to redirect to the previous page. How can I do this?
9
votes
2
answers
39k
views
Why do we have to use "store" for links in CMS like <a href="{{store url='home'}}">home</a>
To insert links in the CMS, we use this code:
<a href="{{store url='home'}}">home</a>
What is this "store" keyword doing and why is it called "store"?
And are there any other keywords ...
9
votes
3
answers
25k
views
Magento 2 - Getting product Image url in Model/block not in template file? [duplicate]
I am sending product data as response for the rest api call, I want to get product Image Url, currently using this:
$imagehelper = $objectManager->create('Magento\Catalog\Helper\Image');
$image = ...
9
votes
2
answers
7k
views
In magento admin url, the word “admin” occurs twice. how to remove the second one?
I have a situation where my client's admin url is something like this;
http://www.example.com/index.php/admin/admin/dashboard/index/key/0981a6bd2f5a06fec85d3c9e297849a0/
the word admin occurs twice, ...
9
votes
7
answers
8k
views
Website start redirecting to another url
Maybe it's infected by some virus.
My website starts redirecting to these infected URL.
http://mon.setsu.xyz
and some time https://tiphainemollard.us/index/?1371499155545
Infected links
what I did ...
9
votes
3
answers
8k
views
Using Secure URLs based on context
I am familiar with using various methods to generate a secure URL based on context, ie:
$this->getUrl('my-page', array('_forced_secure' => $this->getRequest()->isSecure()));
This works ...
8
votes
2
answers
19k
views
Magento2 - Missing required argument
I'm trying to create a block I can call in my override of 'root.phtml'.
In the root file, I added some extra classes to the body depending on the url, so I've created a module which I call on this ...
8
votes
3
answers
24k
views
Magento 2 get custom module image url from backend
I used
<?php echo $this->getViewFileUrl('Vendor_Module::images/demo.jpg'); ?>
<?php echo $block->getViewFileUrl('Vendor_Module::images/demo.jpg'); ?>
But it's working only ...
8
votes
2
answers
20k
views
How to get RefererUrl in magento 2 observer?
How to get RefererUrl (source page url) in Observer file?
Actually by using this;
$this->_redirect->getRefererUrl();
I am getting Referer Url in magento 2 controller file.But in Observer file ...
8
votes
2
answers
9k
views
Get product path from id with category path in url [duplicate]
i want to get product url from id with category path in url :
for same product url are like :
http://websitename/rings/diamond/blue-diamond.html
http://websitename/blue-diamond.html
with my code ...
8
votes
3
answers
8k
views
How to get product's frontend url from backend?
I am developing a extension of Magento 2. I need to get a product's frontend url from backend. I have tried to use:
//$storeManager->->setCurrentStore(2);
$url = $product->setStoreId(2)->...
8
votes
2
answers
6k
views
Get URL of the static content folder (for backend)
Inside a block class which is being used to render a button in the admin panel, how to get the URL of the static content folder? Specifically, URL of the folder with images?
For example, in ...
8
votes
2
answers
10k
views
How to retrieve the Category name, Category URL and Category image using Category-Id?
As we know that in the Category Management page we can upload an image and give a URL for each category. I want to retrieve the Category name, Category URL and Category image using only the Category ...
8
votes
4
answers
4k
views
Always show full URL including categories for product
For our Magento webshop (1.7.0.2), we're trying to optimize the URL structure. We've already managed to improve some things, but in one things we didn't succeed. We want to use a full URL (including ...
8
votes
2
answers
3k
views
Get page URL from current page, different store-view
I'm using different store-views to create different language versions of a shop. Now I'm trying to add links to the other pages. However, I can not find a way to get the actual URL from the other ...
7
votes
2
answers
7k
views
How to check if URL has http:// or https://?
In my Magento website I have configured SSL certificate in some pages only. So how to check if the current page has http:// or https://?
I am using Magento 1.9
7
votes
3
answers
27k
views
How do i call a controller function in ajax?
This is the content of my .../template/exportdb/attributes.phtml file:
<span id = "attributes">Generate</span>
<script type="text/javascript">
jQuery(function () {
...
7
votes
2
answers
13k
views
Magento url key has strange numbers added by the system Magento 1.7.0.2
I've been pulling my hairs to figure out what's going on with my Magento store (1.7.0.2 version). 80% url-keys are appended with strange numbers in two different forms. Some are like this http://www....
7
votes
2
answers
7k
views
What information is required in the ID path of a Magento URL Rewrite
Is it required to use the old URL in ID path? I thought that was just used for personal identification and you can fill in whatever you want?
7
votes
2
answers
3k
views
Best way to check if page is home page
What is the most reliable way to check if current page is the home page? I need to check that in a block class and in a helper class. Searching on forums, I've found two popular ways to do this:
...
7
votes
2
answers
7k
views
Is there a way to pass a coupon code as a URL parameter?
I would like to create URLs which activate a specific coupon. It could be as simple as passing the coupon code as a URL parameter. When a coupon is passed, I'd like it to automatically be populated ...
7
votes
1
answer
3k
views
Magento 2 - Wordpress Integration url issue
I am using a magento 2.1.8 site.
I have installed wordpress in a subdirectory of my root directory.
I have integrated the wordpress and magento site by using fishpig wordpress extension.
All other ...
7
votes
4
answers
3k
views
Magento2: Remove Store Code URL only for default store
I am developing a Magento 2 store with two store views, one for each language(English and Italian). I turned on the "Add Store Code to Urls" option from backend, so my URLs looks like:
http://mystore....
6
votes
4
answers
13k
views
Get parameters from URL Magento 2
Assume I have a URL like this,
http://mystore.com/cms/sales/order/view/order_id/286/
I want to get values of the order_id which is 286,
Please help with some example or snippet in Magento 2.
6
votes
2
answers
13k
views
Internal links to end with a trailing slash
The links in the main navigation end without a trailing slash, which do not match the canonical tags which end without.
Is there an easy way to make all links throughout the site end with a trailing ...
6
votes
1
answer
14k
views
How can I build a redirect URL in a magento 2 js component?
I have added a payment method renderer javascript file to a magento 2 module. I want one of the functions in the js to redirect to another page on the site.
How do I get the base url so that I can ...
6
votes
3
answers
16k
views
Where is the admin path located in database?
I want to find out where does Magento2 keeps it's admin path in the database?
Any suggestions will be appreciated.