Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Open localhost from the command line

Aug
1,917
68
While others may be aware of this, I was not, so I am sharing my findings.

When I want to view my website locally, before publishing to Github, I launch my local website via my web browser.

I discovered that I can also launch my local website via the TCC command line;
Code:
http:\\localhost:9090/index.html

I've also created an alias to launch my local website;
Code:
alias lh=http:\\localhost:9090/index.html

Posting this mainly for my future reference, but others might also be interested.

Joe
 
9090 is a port, right? I searched (just a little) and didn't come up with anything that suggested its use as above. ...???
 
In my case, I use the built-in HTTP server that comes with Everything (which is included with TCC);

1656690331516.png


...which I have configured to use port 9090.

Joe
 
I quite frequently launch web sites from the TCC command line, but I was not aware that one could precede "localhost" with http:\\ in order to launch a web site locally.

I also found out that I can launch a file in my web browser from the TCC command line, thus;
file:///E:/documents/github/joec4281.github.io/index.html
...which eliminates the need for even having to use "localhost".

Note, though, that file:/// is launching via whatever the extension is, in this case, since it is an .html file, it opens in my web browser.

From the TCC command line, if I issue;
Code:
file:///E:/utils\astronomy.txt
...then the file is opened in Notepad, as the extension is .txt

However, as it is just a file with an executable extension, I could just have easily done;
Code:
e:\utils>cd E:\Documents\GitHub\JoeC4281.github.io

e:\documents\github\joec4281.github.io>index.html
...and achieved the same results, since index.html also launches to my web browser.

Many different ways to do the same thing.

Joe
 
I quite frequently launch web sites from the TCC command line, but I was not aware that one could precede "localhost" with http:\\ in order to launch a web site locally.
Or, you can use your computer's name or IP address. TCC passes the request to Windows, which passes it to your browser, which then contacts the host. The webserver can serve files or run a script (e.g., PHP) to generate the response. The only difference is TCC is saving you from having to start your browser.
 
I'm a little late to the party, but shouldn't the "http:\\..." be "http://..."?

Actually, I just tried it; it works both ways.
 

Similar threads

Back
Top