Forum Moderators: coopster & phranque

Message Too Old, No Replies

Virtual URLs

         

Acternaweb

9:59 pm on Dec 6, 2001 (gmt 0)

10+ Year Member



Does anyone know of a script that creates virtual urls? For example:

Physical URL: www.domain.com/html/folder/folder/index.html

Virtual URL:
www.domain.com/whatever

Sticky Mail me if you want more info

Air

4:31 am on Dec 7, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't really need a script to do this, you can use SSI to include the physical URL content into the virtual URL, er.. it's also possible I don't know what you're asking :)

gethan

10:15 am on Dec 7, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Acternaweb,

It sounds like your looking to do something very similar to Jeremy in this thread...

[webmasterworld.com...]

HTH

Acternaweb

1:37 pm on Dec 7, 2001 (gmt 0)

10+ Year Member



I am not sure if that is what I am looking for, it is hard for me to follow. Guess I need to add I can't run PHP which looks like that is.

How do you do the SSI?

seriesint

5:11 pm on Dec 7, 2001 (gmt 0)



hi
Actually that was mod_rewrite, but if you can't run php then mod_rewrite's defintely out of the question. SSI is easy to setup though. You have to name the files in question .shtml ( for server-parsed HTML) this is if your host has enabled SSI for the account. If not, I believe you are stuck looking for a solution. Is the ban just on php? Can you do perl/cgi? First things first try the SSI bit. Here's some basic help on getting started with SSI.

[hotwired.lycos.com...]

[wdvl.com...]

Look specfically for the include virtual=" " function which will allow you to place a file at one location and include it from another place on the server. As in the file index.html at www.example.com/ has an SSI that links to www.example.com/pub/data/index.txt for a portion of its contents. This is real handy to create site wide navigation menus etc.
check it out.

Acternaweb

2:03 pm on Dec 10, 2001 (gmt 0)

10+ Year Member



Great, Thanks I am running a few includes as is now, so I know I can run them on the site.
Will let you know if I can use your expertise again.

Acternaweb

2:09 pm on Dec 10, 2001 (gmt 0)

10+ Year Member



I looked at both sites, and found the paragraph the virtual include, but didn't (or maybe understand), how to make it work for a URL. Is there an actual script/include that I could copy and modify?

seriesint

5:35 pm on Dec 10, 2001 (gmt 0)



I'm not sure of the validity of this as an answer but that never stopped me before ;)
Given you have the page /foo/bar/page.html
and would like for the page to be accessed from /page.html
The SSI would be #include virtual="/foo/bar/page.html" in the file
/page.html. Wrapped inside comment tags of course.
It's not a virtual url and if you have lots of pages it will be a nightmare. Works for a few pages though.
As far as other solutions, the only one I know of that would work without requiring the existence of other files would be mod_rewrite. Doesn't mean there isn't another solution, I just have yet to bump into it.
HTH

Acternaweb

7:32 pm on Dec 10, 2001 (gmt 0)

10+ Year Member



I want to make sure I get this right.

If I want to create a virtual url to be www.domain.com/virtual

and have the point to www.domain.com/html/june/index.html

On the /index.html page I would have
#include virtual="/html/june/index.html"
or
#include virtual="/virtual"
?

seriesint

8:35 pm on Dec 10, 2001 (gmt 0)



>On the /index.html page I would have
#include virtual="/html/june/index.html"

This one. In the index.html file, whereever you want the content from the virtual include to appear (you can have multiple includes). Put this line

<!--#include virtual="/html/june/index.html" -->

most times I use a different ext like .inc or .nav something to id it to me at a later date. It doesn't have to be a full HTML page, snippets of code work fine.

Acternaweb

8:53 pm on Dec 10, 2001 (gmt 0)

10+ Year Member



Thanks Seriesint. I don't have a file that I want included, but rather a URL.

How would www.domain.com/virtual (virtual url)
know to point to www.domain.com/html/june/index.html using this <!--#include virtual="/html/june/index.html" --> ?

I do not have direct access to the server so I can't modify the dns (ie. virtual.domain.com)

Let me know if you want a sticky note to help clarify it more.

Thanks for your help

seriesint

9:21 pm on Dec 10, 2001 (gmt 0)



See, I didn't think that was the actual solution you were after. I was just answering the question hehe. If I'm not mistaken you can point a virtual include to a domain, how that will work if its a complete page, file, I don't know and the url would still be the original page (that is /index.html over www.domain.com/html/june/index.html ) not sure if that's a problem. You could just meta redirect (bad karma according to the w3c, but it works in most browsers) or a plain cgi redirect. mod_rewrite could give you exactly what you are after, but I doubt its available on the server (it's a hosted account, yes?)

And I'm calling off all bets after rereading your post. Is it a subdomain in the form of sub.domain.com or just a sub directory of the base domain? www.domain.com/sub ?> Think I'm beginning too confuse myself, so I'll wait for answers to confuse me more ;)

Acternaweb

2:48 pm on Dec 11, 2001 (gmt 0)

10+ Year Member



HaHa.. I am glad I am not the only one confused.
I am not set in what I want. Basically I have a domain and want to create a sub site with in that so the user would not have to type in the entire path(url).

A sub domain (custom_url.domain.com) would work, but don't I need server access for that?

gethan

3:24 pm on Dec 11, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It all becomes clear - someone trying to do something to please users and not the search engines... no wonder we're confused ;)

Your best bet is to keep it simple and basically use a redirect from

www.yourdomain/shortcut/

to

www.yourdomain/confusing/levels/of/obfuscation/page.html

To do this I recommend making a directory in the base level of your site (where your index.html lives). In this directory make a page called index.html (or whatever your server returns - eg. home.htm, default.htm etc).

Put this content in your html.


<html>
<head>
<meta http-equiv="Refresh" content="0;url=http://yourdomain/confusing/path/page.htm">
<title>Redirect</title>
</head>
<body><a href='http://yourdomain/confusing/path/page.htm'>Please Click here</a></body>
</html>

You should be aware that this is probably the simplest way to do this, there are hundreds of other ways (some are simpler but need more than basic html - server configuration and .htaccess type things.)

Good luck and hope this helps

Gethan

Acternaweb

6:28 pm on Dec 11, 2001 (gmt 0)

10+ Year Member



If I create a folder at the root level, would I really need a redirect? By default wouldn't the page go to index.html

For example www.domain.com/customurl would go to www.domain.com/customurl/index.html?

Any ideas where I can find the virtual URL htacess scripts?

gethan

11:10 pm on Dec 11, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> For example www.domain.com/customurl would go to www.domain.com/customurl/index.html?

Yes - and then www.domain.com/customurl/index.html would direct you to your final destination.

> Any ideas where I can find the virtual URL htacess scripts?

There is no such thing ... .htaccess is a configuration file for apache.