Difference between revisions of "Recommended URL Configuration"

From NeuCart Documentation
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{in progress}}
 
 
 
There are a number of ways to display [[wp:URL|URLs]] for products and categories within a NeuCart store. This article discusses NeuCart's '''recommended configuration for URLs'''.
 
There are a number of ways to display [[wp:URL|URLs]] for products and categories within a NeuCart store. This article discusses NeuCart's '''recommended configuration for URLs'''.
  
Line 9: Line 7:
  
 
== Background ==
 
== Background ==
: ''Main article: [[URL Preferences]]
+
{{main|URL Preferences}}
 
+
 
By default, products show a URL like: <code>example.com/store/productdetail.php?product=123</code>. 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:
 
By default, products show a URL like: <code>example.com/store/productdetail.php?product=123</code>. 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:
 
* http://example.com/store/productdetail.php?sku=SomeSku
 
* http://example.com/store/productdetail.php?sku=SomeSku
Line 18: Line 15:
  
 
== Setup ==
 
== Setup ==
 +
{{note|As with any file-writing process, the server needs to allow access for the .htaccess file to be written and for backups to be created within the folder. These permissions are determined by a store's server and its permissions; NeuCart can offer suggestions on this configuration but ultimately it is the store owner's responsibility for allowing the proper file and folder permissions.}}
 
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.
 
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.
  
 +
=== .htaccess file ===
 +
The server must have an .htaccess file, and as store owner you must know the folder path to that file. The file must include the lines:
 +
<pre>
 +
## neucart start
 +
## neucart end
 +
</pre>
  
<!--
+
Within [[URL Preferences]], the {{ob|.htaccess location}} must be configured to list the full path to the file.
There are several ways to use URLs on your site, each with some pros and cons. Without any external/technical configuration, NeuCart allows a visitor to reach the same product with one of three different URLs:
+
http://yourstore.com/store/productdetail.php?product=123
+
  
See the "Short Product URLs" below, for more information on these URLs. The downside to this method is that the URLs are neither memorable nor SEO-friendly.
+
=== NeuCart configuration ===
  
The "URL Styles" method, described below, uses the name of a product or category as the URL, requiring one-time .htaccess modifications to match the pattern of the URL to the product name. URLs in this example will be something like: http://yourstore.com/store/Some_Product
+
==== URL and Folder Name ====
See "URL Styles, making more useful for SEO" below, for more information on these URLS. The downside to this method is that the category URLs still include the text Category= to determine that something is a category.
+
The first thing that needs to be configured is to determine how the URLs will look: will it include the folder where your store is located or not?. Usually it is one of these choices:
 +
# example.com/some-product
 +
# example.com/store/some-product
  
The "Custom URLs" method gives you complete control over your URL names. This type of URL requires frequent modifications to .htaccess (any time you add a new product or category, or if you decide to change a URL for a product or category). URLs in this example will be anything you want, perhaps:
+
Based on this decision, the [[URL Preferences]] field, {{ob|Start of Canonical Name}} should be configured as one of these choices, respectively:
http://yourstore.com/some-product
+
# http://example.com/
See "Purely Custom URLs" below, for more information on these URLs. The downside to this method is the frequent writing of .htaccess, which can be problematic on some servers and web hosts who do not want to grant easy write-access to the file.
+
# http://example.com/store/
-->
+
  
Purely Custom URLs
+
==== Store Folder ====
 +
The {{ob|Store Folder}} field in [[URL Preferences]] must be configured to indicate the folder of the store. This value is usually "store/" (based on our examples here).
  
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.
+
== Ongoing Configuration ==
In a nutshell
+
Each [[product]] or [[category]] must be configured with the text that is the URL. This field should include the text "my-product" to make a complete URL of <code><nowiki>http://example.com/store/my-product</nowiki></code>. Any time the Custom URL text changes for a product or category, the .htaccess file is rewritten.
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.
+
If, for some reason, the .htaccess file needs to be rewritten without saving a category or product, the [[Admin Support Page|support page]] includes an {{ob|Update .htaccess}} section that allows this functionality.
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:
+
== See also ==
my-song
+
* [[URL Preferences]]
my-product-2
+
{{footer}}
 
+
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:
+
## neucart start
+
## 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/">
+
-->
+

Latest revision as of 03:23, 23 December 2015

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

Notepad icon.svg
As with any file-writing process, the server needs to allow access for the .htaccess file to be written and for backups to be created within the folder. These permissions are determined by a store's server and its permissions; NeuCart can offer suggestions on this configuration but ultimately it is the store owner's responsibility for allowing the proper file and folder permissions.

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.

.htaccess file

The server must have an .htaccess file, and as store owner you must know the folder path to that file. The file must include the lines:

## neucart start
## neucart end

Within URL Preferences, the [.htaccess location] must be configured to list the full path to the file.

NeuCart configuration

URL and Folder Name

The first thing that needs to be configured is to determine how the URLs will look: will it include the folder where your store is located or not?. Usually it is one of these choices:

  1. example.com/some-product
  2. example.com/store/some-product

Based on this decision, the URL Preferences field, [Start of Canonical Name] should be configured as one of these choices, respectively:

  1. http://example.com/
  2. http://example.com/store/

Store Folder

The [Store Folder] field in URL Preferences must be configured to indicate the folder of the store. This value is usually "store/" (based on our examples here).

Ongoing Configuration

Each product or category must be configured with the text that is the URL. This field should include the text "my-product" to make a complete URL of http://example.com/store/my-product. Any time the Custom URL text changes for a product or category, the .htaccess file is rewritten.

If, for some reason, the .htaccess file needs to be rewritten without saving a category or product, the support page includes an [Update .htaccess] section that allows this functionality.

See also

Need a question answered about the Recommended URL Configuration article? Want to offer a suggestion or correction? Click here to discuss this page.