This chapter describes how to configure the system for using extension-less URLs, such as
http://www.example.com/products/kenticocms
instead of
http://www.example.com/products/kenticocms.aspx
Prerequisites
You can use this configuration on Windows XP and Windows Server 2003 with Internet Information Services (IIS) installed. It's not possible to use it with Visual Studio's built-in web server.
Configuration
1. Go to Start -> Control Panel -> Administrative Tools and launch the Internet Information Services (IIS) Manager. Locate the appropriate web site and virtual directory (if you installed Kentico CMS into the root, you will make this change on the web site level only).
2. Right-click the directory (or web site) and choose Properties and then click the Custom Errors tab:
3. Edit the 404 error and enter the following values:
• | Message type: URL |
• | URL: enter the URL of the cmspages/handler404.aspx page according to your application's URL. Example: if you run your web project in virtual directory /kenticocms, you need to enter /kenticocms/cmspages/handler404.aspx |
4. Now repeat the same for the 405 error, using the same custom URL: /kenticocms/cmspages/handler404.aspx
Click OK on all dialogs to save the changes. It's not necessary to restart the application.
5. Now go to Kentico CMS Site Manager -> Settings. Choose either the global configuration or site-specific configuration and choose the URLs configuration section. Clear the Friendly URL extension textbox value and click Save.
If you want to enable other friendly URL extensions along with extension-less URLs, you can enter the URLs divided by a semicolon, while two semicolons enable the extensionless URLs. The first value will be used for generating the URLs displayed in browsers.
Example: entering ;;.aspx;.html enables .aspx and .html extensions and extensionless URLs; because the two semicolons are entered first, extensionless urls will be displayed in your browser.
Now when you go to the live web site, you will see that all URLs in menus and listings are rendered without extension. You may, however, need to update some static links that were created with default .aspx extension.
Configuring extension-less URLs on IIS 7
The setup procedure on IIS 7 is slightly different due to IIS 7's different user interface.
1. Open Start -> Control Panel -> Administrative Tools -> Internet Information Services (IIS) Manager.
2. Select your web site from the tree on the left and open the Error pages section.
3. Right-click the 404 error and choose Edit Feature Settings.
4. Enter the following values:
• | Path: enter the URL of the cmspages/handler404.aspx page according to your application's URL. Example: if you run your web project in virtual directory /kenticocms, you need to enter /kenticocms/cmspages/handler404.aspx |
• | Path type: Execute URL |
Click OK.
5. Now right-click the 404 error again and choose Edit from the context menu.
6. Select Execute a URL on this site and enter the same URL that you entered in step 4. Click OK.
7. Go back to step 3 and repeat the same procedure for the 405 error.
8. Click OK on all dialogs to save the changes. It's not necessary to restart the application.
9. Now go to Kentico CMS Site Manager -> Settings. Choose either the global configuration or site-specific configuration and choose the URLs configuration section. Clear the Friendly URL extension textbox value and click Save.
If you want to enable other friendly URL extensions along with extension-less URLs, you can enter the URLs divided by a semicolon, while two semicolons enable the extensionless URLs. The first value will be used for rendering the URLs displayed in browsers.
Example: entering ;;.aspx;.html enables .aspx and .html extensions and extensionless URLs; because the two semicolons are entered first, extensionless urls will be rendered in your browser.
Now when you go to the live web site, you will see that all URLs in menus and listings are rendered without extension. You may, however, need to update some static links that were created with default .aspx extension.
Page url: http://devnet.kentico.com/docs/devguide/index.html?configuration_of_extensionless_urls.htm