htaccess Redirect – Magento e-Commerce CMS

Recently I aquired a client who was in need of redirecting their home page, let’s call it

www.thisisthepage.com

to their sales page at the virtual path of:

www.thisisthepage.com/category/index/sale

They wanted to utilize an .htacess redirect to not only redirect all requests to the root of the site to the sales page, but to also mask the url so that the sales page would be presented as the homepage of the website.

Now, as you may know you can create rules inside of a .htaccess file to control this redirect and mask, however when using CMS systems it can be a little more challenging because there usually are some .htaccess rules already in effect that may contradict with your rules and make things difficult to accomplish.

For Magento users, here’s a quick  tip to help you accomplish this goal. Magento is e-commerce software with a built in CMS engine. It allows full control over your store based website including choosing which page is the home page of the site.

  1. Go to the Settings menu and select Configuration.
  2. On the left hand side select WEB from the menu
  3. You will see the optoin to choose which page acts as the homepage of the website. From here you can select using the drop down menu any of your pages.

That’s great for pages, but what if the page you wish to use is not listed in your pages because it is part of your web store? Usually the web store pages are database driven and loaded using the root level index.php file through its coding. So the page you want to act as the homepage is, for example

www.thisisthepage.com/catalog/index/sale

in the address bar when you visit it on the live site. Notice there is no index.php at the end or any other specific file and extension for that matter.

The solution here is to make use of the Default Web URL field. Currently most likely set to CMS (or cms), you can change this to the direct http path to the portion of your site you wish to be displayed as the home page. Magentowill then re-route all incoming traffic to your root level to this sub level page and the address in the browsers address bar will still read

www.thisisthepage.com

as opposed to

www.thisisthepage.com/catalog/index/sale

thereby completing making this virtual path your homepage.

So there you have it. If you are using Magento as your e-commerce, great software by the way, make use of its web configurations settings to control such a task in your site.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s