Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [url]

Denotes question about URL issues and custom URLs.

54
votes
13answers
82k 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?
29
votes
5answers
21k 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/ -> ...
27
votes
4answers
31k 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 ...
26
votes
12answers
65k views

Remove /index.php from the Magento URL gives 404 error

I am using Magento ver. 1.7.0.2. Here is the link of my website: http://dev.blokeundees.com.au/ I have to remove /index.php from the URL so I have changed into the .htaccess file and backend (secure,...
26
votes
3answers
52k 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.
25
votes
1answer
101k 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? ...
18
votes
2answers
15k views

Magento 2: Product URL Suffix

How do I remove the .html suffix from the product pages?
17
votes
4answers
18k 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...
16
votes
3answers
35k 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 ...
15
votes
2answers
58k 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(); ...
15
votes
3answers
12k 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
2answers
23k 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)
14
votes
8answers
21k 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?
14
votes
4answers
9k 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="" /&...
13
votes
5answers
12k 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
1answer
946 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-&...
11
votes
1answer
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
3answers
13k 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
2answers
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
3answers
21k 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
3answers
20k 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'=>$...
9
votes
7answers
6k 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
3answers
2k 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 => [...
9
votes
3answers
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
5answers
27k 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-...
8
votes
2answers
8k 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
2answers
6k 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, ...
8
votes
3answers
4k 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
2answers
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
2answers
4k 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
4answers
3k 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 ...
7
votes
2answers
32k 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 ...
7
votes
2answers
5k 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
3answers
23k 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
2answers
12k 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
2answers
1k 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
2answers
11k 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
1answer
6k 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 ...
6
votes
4answers
3k 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
2answers
6k 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?
6
votes
2answers
7k views

Setting AJAX URL for custom module

I have a JavaScript file in /js/mds/mds_collivery.js. In it I have an AJAX call that should go to magento_install_url/collivery/ajax/cptypes. It will only be used in /checkout/onepage/. However, if I ...
6
votes
2answers
2k 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: ...
6
votes
2answers
4k views

How could I get the attribute(manufacturer) Url Like example.com/brands/nike in magento

I have a site naijafeet.com.. In this i want the products listed by attribute(manufacturer) name..If I enter naijafeet.com/brands/nike or puma then the items come from those attribute..Please give me ...
6
votes
2answers
9k views

Redirect 'non www prefix to 'www' prefix still not working after disabling 'Auto-redirect to Base URL'

Magento install was redirecting all 'non-www' urls to the root home page. I found these questions on the same subject: Redirected to the Homepage when add www. in any URL Redirected to the Homepage ...
6
votes
2answers
3k views

Change Magento URL category Rules

I'm trying to modify URL-Category Rules, from Category Hierarchy-Oriented rules to Seo-Oriented rules. So i need to change URLs in this way. From: - Root-Category (URL: /rootcategory.html ) -- ...
6
votes
2answers
4k 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/...
6
votes
2answers
124 views

Keep URL's in a place

In my magento 1.8 project, I have some URL's which are calling some other sites like blogs, youtube videos etc. I want these URL's to keep in admin so that the client/store owner can change them later ...
6
votes
2answers
2k 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 ...
5
votes
2answers
12k views

Magento 2: Get image url

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 ...
5
votes
3answers
15k views

How to get Admin page url?

I want to get the current url of an admin panel page. I tried the folowing. $currentUrl = Mage::helper('adminhtml')->getUrl(); But it's not returning the current url.