Home » Archive

Articles tagged with: url

Magento, Magento 2 »

[9 May 2016 | One Comment]

This article shows how we can check if current URL and frontend URl are secure (https) or not in Magento 2.
Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of StoreManagerInterface in the constructor of my module’s block class.

Magento »

[23 Feb 2015 | One Comment]

Here are the code snippets to check for different secure URLs in Magento.
Secure URL can be enabled from configuration settings (System -> Configuration -> GENERAL -> Web -> Secure).
Enable Secure URL in Frontend

Magento »

[30 Sep 2013 | No Comment]

Problem:
You have a Magento website with Base URL = http://example.com/
Working: http://example.com/category-one.html
Not working: http://www.example.com/category-one.html (redirecting to homepage)

Javascript »

[28 Jan 2011 | 3 Comments]

Here is a quick code to get the current URL of a page with Javascript:-
var current_url = location.href;
Here is another way:-

Magento »

[10 Dec 2010 | No Comment]

In your Magento shop URL, if you see “index.php” and wanted to remove it then here is the solution.

– First of all, apache module ‘mod_rewrite‘ should be enabled. Check apache’s httpd.conf file.
– Then login to Magento admin panel
– Go to System -> Configuration -> Web -> Search Engines Optimization -> Use Web Server Rewrites
– Select ‘Yes‘ from the selection list
– Save

PHP »

[11 Oct 2010 | 10 Comments]

Suppose you are on a page : http://example.com/category/php/
Now, the base URL or the main URL for the above link is : http://example.com
Similarly, in the case of local machine (localhost),
Suppose you are in the page : http://localhost/myproject/index.php?id=8
Here, the base or main URL is : http://localhost/myproject

PHP, Regular Expression »

[22 Apr 2010 | One Comment]

Here, I will be showing you a simple and easy one line code to format URL string with PHP. By URL string, I mean the url key in any Search Engine Friendly URL.
I have used preg_replace function to do so.

Magento »

[20 Feb 2010 | 9 Comments]

Breadcrumbs are very useful for user navigation. Breadcrumbs for product page, category page, etc. are created by default Magento code.
The following code will show breadcrumbs created by Magento. You can print the following code anywhere in php or phtml files.

Magento »

[23 Nov 2009 | 8 Comments]

Getting URL of a current page you are visiting or working on is a common requirement in any web development project. There are various ways you can get the current URL of a page in Magento. Here are some :-
From Mage_Core_Helper_Url class