Ecommerce Templates > Search engine friendly > Search engine friendly URLs - ASP Version
It is possible to make the URL structure of the ECT generated URLs even more search engine friendly by removing any files extensions or query parameters by using URL Rewriting - (Your server must support this and your host may need to carry out some of the steps for you), leaving you with the cleanest URL possible, www.yourstoreurl.com/your-product-name. This should also help in your offline marketing efforts, making it much easier to show and spell out the URL of particular products and categories. This feature requires a minimum version of ECT of 6.4.
These are the steps required if you are using the ASP version of Ecommerce Templates
Open your products.asp and categories.asp pages and just before the opening <head> tag add the following
<base href="http://www.yourstoreurl.com/" />
If you have your store in a different folder and not in the web root that would be something like
<base href="http://www.yourstoreurl.com/store/" />
If your site has an SSL certificate installed that would need to be
<base href="http<% if request.servervariables("HTTPS")="on" then response.write "s"%>://www.yourstoreurl.com/" />
In vsadmin/includes.asp the following parameters are available...
seodetailurls=TRUE
seocategoryurls=TRUE
detlinkspacechar="-"
seocaturlpattern="/category/%s"
seoprodurlpattern="/products/%s"
seomanufacturerpattern="/manufacturer/%s"
seourlsthrow301=TRUE
The parameters explained
By setting this parameter the cart will produce Product Detail Page URLs in the new SEO format...
seodetailurls=TRUE
By setting this parameter the cart will produce Category and Product Page URL's in the new SEO format...
seocategoryurls=TRUE
This parameter is optional but if used will replace space characters in your product names with the character specified.
detlinkspacechar="-"
These parameters are optional but can be used to override the default category and product page URL formats.
seocaturlpattern="/category/%s"
seoprodurlpattern="/products/%s"
seomanufacturerpattern="/manufacturer/%s"
This parameter is optional and shouldn't be used until you have your SEO URL system fully functional. Adding this parameter will cause an HTTP 301 Moved Permanently error to be generated (to inform Search Engines that your page has moved to a new location) and will cause the page to automatically forward to that new location.
seourlsthrow301=TRUE
You will need to ask your host to have the URL Rewrite IIS Extension installed for you in IIS (Internet Information Systems). This can be downloaded here for free...
http://www.iis.net/downloads/microsoft/url-rewrite
Now there are two methods you can employ to get the extension-less search engine friendly URLs. We recommend trying the first web.config method but if that doesn't work for you, try the second URL Rewrite changes
This is probably the simplest way of doing things. We have prepared a file called web.config that needs uploading to the root of your store. First of all you need to check if there is already a file called web.config on the server. If that file isn't already present download the config.zip file, unzip it and upload web.config to the store root.
If there is already a web.config file you will need to merge the contents of the existing file with the one available for download. Open the existing web.config file in a text editor. Download the config.zip file, unzip it and also open that in a text editor.
If for example the existing web.config file contains the following
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<asp scriptErrorSentToBrowser="true" />
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
</configuration>
You would add the Rewrite code so you have something like this
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<asp scriptErrorSentToBrowser="true" />
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
<rewrite>
<rules>
<rule name="Categories Match" stopProcessing="true">
<match url="^category/([^/]*)/?$" />
<action type="Rewrite" url="categories.asp?cat={UrlEncode:{R:1}}" />
</rule>
<rule name="Product Match" stopProcessing="true">
<match url="^products/([^/]*)/?$" />
<action type="Rewrite" url="products.asp?cat={UrlEncode:{R:1}}" />
</rule>
<rule name="All Manufacturer Match" stopProcessing="true">
<match url="^manufacturer/?$" />
<action type="Rewrite" url="categories.asp?man=all" />
</rule>
<rule name="Manufacturer Match" stopProcessing="true">
<match url="^manufacturer/(.*)$" />
<conditions>
<add input="{UNENCODED_URL}" pattern="manufacturer/[^/]*" />
</conditions>
<action type="Rewrite" url="products.asp?man={UrlEncode:{R:1}}" />
</rule>
<rule name="Product Detail Page Match" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{URL}" pattern="\.asp" negate="true" />
<add input="{URL}" pattern="\.css" negate="true" />
<add input="{URL}" pattern="\.gif" negate="true" />
<add input="{URL}" pattern="\.jpg" negate="true" />
<add input="{URL}" pattern="\.js" negate="true" />
<add input="{URL}" pattern="\.png" negate="true" />
<add input="{URL}" pattern="\.xml" negate="true" />
<add input="{URL}" pattern="robots\.txt" negate="true" />
<add input="{UNENCODED_URL}" pattern="[^/]+" />
</conditions>
<action type="Rewrite" url="proddetail.asp?prod={UrlEncode:{R:1}}" />
</rule>
</rules>
</rewrite>
</system.web>
</configuration>
Save that file and upload it again to the store root.
You can now test the extension-less URLs, making sure you have also added the new paramters listed above to vsadmin/includes.asp. If you have tested, made sure the file changes are correct and it's not working for you, there is anoher method available but this will require the help of your host.
You will need to ask your host to set up a total of 5 rules added to URL Rewrite for your site.
1. Category MatchIIS -> Request Filtering -> Edit Feature Settings... -> Allow Double Escaping
Again test the pages on your site and if you run into any problems, please post on the support forum.
Choose your own URL for the detail page
It is possible to not use the product name for the product detail URL and to enter the one of your choice. In the product admin page select "Has Static URL"
and enter the text you would like to appear. In this case you would get an address of yourstoreurl.com/my-page-name
From Version 6.9.2 Extensionless URL's or URL's with non-standard extenions can be created for all cart pages by specifying the parameter "extension" in your includes.asp file. For extensionless URL's you can set the parameter to an empty string as follows...
extension=""
You may also want to use a trailing slash for cart pages, for instance...
extension="/"
This would make the cart page URL
yoursite.com/cart/
For this to work you do need to have access to a URL rewriting method as the rewritten URL needs to be mapped back to the page name with the .asp extension, but it will mean that internally generated links will use the extension you specify.
For example, for the cart page an URL like this http://www.ectdemostore.com/uk_demo/cart/ would need the following adding to web.config
<rule name="Cart Match" stopProcessing="true">
<match url="^cart/" />
<conditions>
<add input="{UNENCODED_URL}" pattern="cart/" />
</conditions>
<action type="Rewrite" url="cart.asp" />
</rule>
Remember to add the following in the HEAD section somewhere before your css lines on each of the extensionless URL pages.
<base href="http<% if request.servervariables("HTTPS")="on" then response.write "s"%>://www.yourstoreurl.com/" />
It's crucial that once you have the extension-less URLs set up that you fully test your store. This not only means flicking through the pages and links on your site but also looking under the hood and making sure the correct server headers are returned so search engines can find, crawl and index the new URLs.
The first thing you should do is check the HTTP status returned by the server. There are several sites that allow you to type in the URL of your pages and check the server response, for example
You would be looking at the page returning a 200 HTTP response. If you get a 404 response it would indicate a problem as your page wasn't found. In this instance you would need to go over the instructions again and if you can't find where the problem lies, please post on our support forum.
For ongoing monitoring we strongly recommend seting up a Webmaster Tools account if you don't already have one. As your site is crawled any server errors will be reported along with the referring link and date of discovery. It may take several days or weeks for new pages to be found and reported but it does allow you to keep on top of any errors over time.
If the css doesn't render on your new search engine friendly pages, make sure that the "base href" line comes somewhere before any css line or the "incectstyle.asp" include line, eg
<base href="http://www.yourstoreurl.com/" />
<!--#include file="vsadmin/inc/incectstyle.asp"-->
<link rel="stylesheet" type="text/css" href="/style.css" />
If you are seeing some 404 errors on particular products or categories, check that the product or category name doesn't include non-permitted characters such as a dash or period.