problem mapping URLs |
problem mapping URLs |
benny |
Oct 3 2006, 12:50 PM
Post
#1
|
Group: Members Posts: 2 Joined: 3-October 06 Member No.: 316 |
Hello, I'm trying to create a simple mapping where for instance widget.com/cool would map to widget.com/index.cfm . I don't want to actually forward the user to the 2nd URL - i'd like their browser to still believe it is at widget.com/cool (or widget.com/cool/index.cfm).
I've been trying with a simple server-side include, but that is messing with the paths. I guess i could create a path variable and have it everywhere in my site, but I'm wondering if there is a more simple way. Thanks This post has been edited by benny: Oct 3 2006, 12:50 PM |
Darin McGrew |
Oct 3 2006, 01:01 PM
Post
#2
|
WDG Member Group: Root Admin Posts: 8,365 Joined: 4-August 06 From: Mountain View, CA Member No.: 3 |
The same relative URLs will work in both example.com/cool and example.com/index.cfm , however example.com/cool/ and example.com/cool/index.cfm are at a different level in the URL hierarchy, so relative URLs will need to change.
Another option is to use "root relative" URLs like /images/foo.png rather than relative URLs like ../images/foo.png or ../../images/foo.png |
Christian J |
Oct 3 2006, 01:08 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
The same relative URLs will work in both example.com/cool and example.com/index.cfm , however example.com/cool/ and example.com/cool/index.cfm are at a different level in the URL hierarchy, so relative URLs will need to change. Didn't you mean the opposite? |
benny |
Oct 3 2006, 01:34 PM
Post
#4
|
Group: Members Posts: 2 Joined: 3-October 06 Member No.: 316 |
yeah, I'm using root relative urls and just giving a different root path depending on where the script is included from. thought there might be an easier way. I've heard there's some easier way to map paths between browser and server,
This post has been edited by benny: Oct 3 2006, 01:36 PM |
pandy |
Oct 3 2006, 02:57 PM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I'm confused. Are you trying to create an include directive that can be used from anywhere on your site? Then use include virtual and root relative paths.
Or are you trying to make nice URLs for the users so they won't see the real URL? Then you need mod_rewrite or something else esoteric. |
Sparkyg |
Oct 3 2006, 05:52 PM
Post
#6
|
Member Group: Members Posts: 46 Joined: 29-September 06 From: Suffolk UK Member No.: 270 |
Hi There
If you are running apache server then mod_rewrite should be available just add a couple of lines to your .htaccess file RewriteEngine On RewriteRule /cool /index.cfm [QSA,L] cheers Len |
Peter1968 |
Oct 9 2006, 04:15 AM
Post
#7
|
Serious Coder Group: Members Posts: 448 Joined: 23-September 06 Member No.: 213 |
Or, if mod_rewrite isn't available:
In a .htaccess in your docroot Redirect 301 /cool http://www.widget.com/index.cfm You can also use <Alias>, <scriptAlias> etc, but they're a little more involved. http://httpd.apache.org/docs/1.3/urlmapping.html Apache's URL mapping schemes. |
Lo-Fi Version | Time is now: 26th April 2024 - 06:36 AM |