Link to home
Start Free TrialLog in
Avatar of WestCoast_BC
WestCoast_BCFlag for Canada

asked on

Question regarding URL handling for a website

I have noticed that some websites have URLs for their pages that make it easy for the user to remember. For example, a website may have something like: www.samplesite.com/aboutus which takes the user to their About Us page. How do they handle these URLs? I am guessing they do not create a subdirectory for each page, ie do they have to create a subdirectory called aboutus?

My websites are written using Lucee (Coldfusion) on a Windows server. I would appreciated any help that you can provide.
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

While you can use physical folders, they are typically using a router where all calls go to the index page and your index page serves the appropriate content.

I am not a CF dev but this is a good explanation https://guides.cfwheels.org/docs/routing
www.samplesite.com/aboutus  may be a folder having a default document there, and all related sub-links referred from default page...

or they may have url-rewrite module on web server and that url may be mapped to a specific page like

www.samplesite.com/web/pages.asp?pageID=152433 
Avatar of WestCoast_BC

ASKER

Thank you but I do not use or am familiar with cfwheels.

Is it possible to add something to my web.config file to handle this?
You can direct all traffic to your index like below and then on your index.cfm convert all the traffic going to mysite.com/product/251 so it acts like mysite.com?product=251.  I have tried doing this in old classic asp and it is much easier to use a library if one exists.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="route_all_to_index" patternSyntax="Wildcard">
                    <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.cfm" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Open in new window


Well. One way is to make that page start with thesame page. For example index.cfm and then in IIS in home page specify index.cfm as a default option and make it run as number 1. That should do it. 
I don't understand the solution to make the page start with the same page. Are you suggesting that the home page be samplesite.com/aboutus? That might work if I only needed to handle one URL but I need to do this for all menu items and it has to be handled in a way that is automatic. The site admin can add and remove items from their menu and I would like to be able to handle nice URLs that are tied to their menu buttons.
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think changing the web.config as you suggested is the easiest thing for me to do. Thank you for your help.