Post by Qphoria » Fri Jan 16, 2009 4:52 am

URL Alias is a way of cleaning up your website urls to:
a) Look neater, easier to read
b) Be more Search Engine Friendly (SEF) aka Search Engine Optimized (SEO)

So how does it work in OpenCart?
A normal opencart url (with url alias turned off) looks something like:

Code: Select all

http://www.example.com/shop/index.php?controller=product&product_id=44
It's not too complex, but could be a lot neater. That's where url alias comes in.

There are actually 2 levels of url improvements.

First, there is what is called "Remastering" which is essentially replacing '?', '&', and '=' with '/'.
When you first enable url_alias, that turns on the remastering code. Now all urls will change
from this:

Code: Select all

http://www.example.com/shop/index.php?controller=product&product_id=44
to this:

Code: Select all

http://www.example.com/shop/product/product_id/44
It's a lot cleaner, but still rather cryptic.

So the second part of url alias is creating an actual alias of your own to replace all the extra query data.
You can replace "product/product_id/44" with "product-44.html" or even something more specific like "dvd-player.html"
You will then change
from this:

Code: Select all

http://www.example.com/shop/product/product_id/44
to this:

Code: Select all

http://www.example.com/shop/dvd-player.html
Much nicer!

How do I set it up?
1. The default .htaccess file that comes with OpenCart has all the mod_rewrite commands needed for url alias to work. However, if you are running your store in a subdirectory of your website's root path, then you will need to edit your htaccess file and remove the # at the start of "RewriteBase". And change the folder name from "/shop/" to whatever you called it.
So if your store is at http://www.example.com/index.php. Then you don't need to configure anything
but if your store is at http://www.example.com/shop/index.php. Then you need to edit the htaccess file as stated above.

2. Once that is set up, Log into your admin area. Goto Admin->Configiuration->Settings. On the "Shop" tab set 'url alias' to YES and save the settings.

3. Goto the frontend of your store. Click on some links. You should now see the 'remastered' url style in your address bar.

4. Go back to the admin area and goto Admin->Configuration->URL Alias

5. Here you can set up the actual aliases. The format is original url query on the left, new custom url alias on the right. You can change the Alias on the right to anything you want, but the query must match the actual location to the target. See the attached image for an example. Save it and goto the frontend again. You should now see the new url alias links!

Attachments

???
url_alias_demo.jpg
Last edited by hm2k on Fri Jan 16, 2009 7:30 am, edited 1 time in total.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 5 guests