Recommended URL Configuration

From NeuCart Documentation
Revision as of 18:55, 26 November 2014 by NeuCartAdmin (Talk | contribs)

Jump to: navigation, search
VLC icon.png This page is under construction. This message will remain until the page meets the NeuCart documentation standards.

There are a number of ways to display URLs for products and categories within a NeuCart store. This article discusses NeuCart's recommended configuration for URLs.

Essay.svg
This article discusses one or more best practices for configuration of a NeuCart store.
Binary-icon.png
This article discusses a
technical topic that may not be
intended for all readers.

Background

Main article: URL Preferences

By default, products show a URL like: example.com/store/productdetail.php?product=123. A URL like this is not memorable, and it is also unfriendly to search engines. Some other methods create more human-readable URLs without any external/technical configuration, like:

NeuCart allows Wikipedia-like URLs, such as: example.com/store/My_Great_Song_(MP3_Download), but this is not the preferred method. The preferred style of URL looks like this: example.com/store/my-great-song-mp3-download. NeuCart refers to this as "Custom URLs", or sometimes "Purely Custom URLs" (to distinguish from auto-alphabetical Custom URLs).

Setup

Setup for custom URLs is done once, and it is technical, but after setting it up, a store owner never needs to think about configuration again. Custom URLs function as part of the .htaccess functionality that is present on most web servers.


Purely Custom URLs

In NeuCart, "Purely Custom URLs" refers to the "Custom URL" fields that can be configured for both products and categories. As long as NeuCart is able to make changes to your .htaccess file, Custom URLs are the easiest, most straight-forward way to create memorable URLs for your site. In a nutshell These are the no-frills documentation steps. For more in-depth information, continue to the sections below.

Steps #1 and #2 you'll do once. Steps #3 and #4 you'll do as needed. Decide how your URLs will look. Usually this is: http://yoursite.com/some-product or htp://yoursite.com/store/some-product Based on this decision, go to URL Preferences and enter http://yoursite.com/ or http://yoursite.com/store/ in the "Start of Canonical Name" field. In URL Preferences, under "Store Folder", enter the folder where your store is located. This is usually "store/" or "products/", based on the configuration of NeuCart within your site. For each product or category, enter the text you want to be the URL. For example, enter "my-product" to make a complete URL of "http://yoursite.com/my-product". The text entered in this field is appended to the value you entered into step #1 of these instructions to make the complete product URL. Any time you add, delete, or modify a "Custom URL" for products, click the "Update .htaccess" link from the Admin main page. Configuration, detailed URL Preferences When using Custom URLs, the first fields that you should configure are the "Custom URL Settings" fields within URL Parameters: .htaccess location: This is the full path to the htaccess file, including the name of the file itself. For example, /home/username/public_html/.htaccess Store folder: This is the folder where NeuCart is installed, or it is blank if NeuCart is installed in the root. More on this below: "What actually happens". Start of Canonical Name: This is usually http://yourstore.com/ - more information on this below also. Between Canonical Start and Custom URL: This field is generally "store/", representing the text that goes between your domain name and the product or category "Custom URL" text. Products and Categories Products and categories have a "Custom URL" field that allows you to configure the name of the URL that will be visited. This field must be unique amongst all products and categories, and NeuCart verifies the uniqueness of URLs upon save.

In this field, you do not configure the full URL; you configure the part of the URL that appears after the Custom URL settings "Start of Canonical Name" field. For example: my-song my-product-2

Note that currently, Google prefers dashes to underscores for "SEO-Friendly" URLs. What actually happpens After configuring your products and categories, you will need to click the "Update .htaccess" link on the main Admin portal page. This action looks in the .htaccess file for these lines:

    1. neucart start
    2. neucart end

NeuCart will then place all the redirection links between those lines. The redirection looks like this: RewriteRule ^store/my-song$ /store/productdetail.php?product=194 [NC] RewriteRule ^store/my-product-2$ /store/productdetail.php?product=201 [NC] RewriteRule ^store/my-category$ /store/index.php?category=1234 In this example, yourstore.com/store/my-song is the URL, displaying the page that is actually configured in the store folder, the product detail page with the product id of 194. To explain more, what this means in this example is that: The product has a "Custom URL" of "my-song" (this field is after the "^store/" text at the beginning of the line) The "Between Canonical Start and Custom URL" field is configured as "store/" (this field is at the beginning of the line) The URL Preferences "store folder" is configured as "store/" (this field is after the $ character) With these two settings, NeuCart knows how to create the URL redirections. Two other settings are relevant: The URL Preferences option, "Start of Canonical Name", is used on the product and category pages to create the "canonical" link, which helps search engines to know the preferred URL of the page. In our example, this value would be configured as http://yourstore.com/, meaning that the canonical name combines that field with the Custom URL of the product, for a total value of http://yourstore.com/my-song When configuring URLs that aren't a part of the original folder — as in this example, where the store is in the "store" folder but the URLs are not — you must configure the "base" tag for the page. This makes sure that all the URLs have the correct relative path. In this example, the HTML Base Tag field, configured in Web Text, would have the value <base href="http://yourstore.com/store/"> -->