Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

Problem using localhost for web content uploading...

Hi friends !

I am designing my website using HTML / Advance HTML and CSS. I am a beginner in web development. (though I know enough HTML/XHTML and CSS to start with.)

I am also using Server Side Includes for my web pages. That is why for webpage extension I used .asp extension. I also prepared an IIS web server (Test web server for my domain www.kie.ac.rw, offline and local connected to only a XP machine from where I am browsing) and hosted my web contents there.

I am able to browse .asp files using HTTP in this way:

http://www.kie.ac.rw/index.asp

In my template page also, I have given HTTP paths for web links/include files and also for style.css. (Note again that because I was using www.kie.ac.rw on IIS Server, everything was working fine.). Please look at the sample paths:

**************************************
<link rel="stylesheet" type="text/css" href="http://kie.ac.rw/style.css" media="screen" /> (For style.css)

<li><a href="http://www.kie.ac.rw/notices.php">Notices</a></li> (For notices.asp)
**************************************

Now this is unfortunage to me that here our IT department is more interested in .php (and in Open Source), so I have to switch from .asp to .php. And IIS Server doesnt host files with .php extension.

Now, I have to use Apache Server (or EasyPHP, XAMPP Server). But in that situation, I will have to upload my website locally using http://localhost/ and I will also browse my .php pages like this:

http://localhost/index.php


So, please tell me whether it will not give me problems when I will really upload it to the ISP end ???

I am really confused and not understanding what to do.

Please tell me generally what is done to get ride of this situation.

Regards,

Hemant
0
JatinHemant
Asked:
JatinHemant
  • 7
  • 5
  • 2
7 Solutions
 
Ted BouskillSenior Software DeveloperCommented:
IIS can easily support PHP files.  If you search the PHP Org site they have information on installing PHP with IIS.  Apache doesn't run well on Windows, it's better suited to Linux.
0
 
JatinHemantAuthor Commented:
Thanks for your reply.

Let me go through the php site and will be back soon.

Regards,

Hemant
0
 
Ted BouskillSenior Software DeveloperCommented:
Even Microsoft's IIS site has information on it: http://www.iis.net/php
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
giltjrCommented:
I would suggest that you do not use specific paths on your hrefs, but relative paths.

So  href="http://kie.ac.rw/style.css"  becomes href="/style.css".  This way the host name does not matter.  If you use a specific path, if you use the same code on a different host you have to change it.

The only time a specific path is needed, is if you are putting the code on a server that is different than were the pages reside.
0
 
JatinHemantAuthor Commented:
Thanks to both of you.

giltjr !

Actually I am getting what you say but please explain me with my example.

As I told you that I have installed Testing Web Server using Microsoft IIS and hosted the website with my real domain name: www.kie.ac.rw (in the same manner ISP does)

Now, you mean to say that if I want to go to "Notices" section or to locate my style.css file, I SHOULD NOT use:

<li><a href="http://www.kie.ac.rw/notices.php">Notices</a></li> (For notices.asp)

<link rel="stylesheet" type="text/css" href="http://kie.ac.rw/style.css" media="screen" /> (For style.css)

But please tell me if I use href="/notices.php", how the internet users will be able to access the notices.php page.

and the same thing for css also ?

Please explain me clearly.

Regards,

Hemant
0
 
giltjrCommented:
If you use a relative link, that is one with out HTTP in front of it, the browser will assume that it is located on the same server as the original page.  It works for any href.

In fact when you are viewing this post, just view the source for the EE page and search for href throughout the page.  You will see that the majority of the hrefs are relative hrefs.

Its not the "Internet" that finds it, its the browser that prepends the current host and protocol to the reference.

This especially comes in handy when you are doing SSL encrypted sites.  If you use SSL but all your hrefs have HTTP, then all of the hrefs are not encrypted and you get that nasty pop-up,  some items on this page are not encrypted are you sure you want to continue.
0
 
JatinHemantAuthor Commented:
Thanks for your reply.

I got it. But please let me explain what I understood and what I am supposed to do now.

My web contents are in D:\kie folder. I am not using localhost. I have configured new website named: www.kie.ac.rw. And "kie" is my root folder where I have placed my files.

Right now when I want to go to "Home" , I use:

<a href="http://www.kie.ac.rw/index.php">Home</a>

and when I want to go to "da.php" (Here, da stands for Directorate of Administration and the file is in D:\kie\directorate\da.php)

<a href="http://www.kie.ac.rw/directorate/index.php">Directorate of Finance</a>

So, now I should change it like this:

<a href="/index.php">Home</a>
<a href="/directorate/index.php">Directorate of Finance</a>

Am I right ? If I am wrong, please correct me.

Regards,

Hemant

0
 
JatinHemantAuthor Commented:
Ohhhhhhhh.....Sorry...

I typed some wrong statements. I am posting again.

My web contents are in D:\kie folder. I am not using localhost. I have configured new website named: www.kie.ac.rw. And "kie" is my root folder where I have placed my files.

Right now when I want to go to "Home" , I use:

<a href="http://www.kie.ac.rw/index.php">Home</a>

and when I want to go to "da.php" (Here, da stands for Directorate of Administration and the file is in D:\kie\directorate\da.php)

<a href="http://www.kie.ac.rw/directorate/da.php">Directorate of Administration</a>

So, now I should change it like this:

<a href="/index.php">Home</a>
<a href="/directorate/da.php">Directorate of Administration</a>

Am I right ? If I am wrong, please correct me.

Regards,

Hemant
0
 
giltjrCommented:
You have is correct.  

By using the relative reference in your browsers url you can use any host name you want (www.kei.ac.rw, localhost, 127.0.0.1, or mybestsiteever) as long as the names reslove to the IP address where the server is and the server is configured to put you in the correct directory and you can get to everything fine.
0
 
JatinHemantAuthor Commented:
One last thing....

Almost all the web servers (including IIS, Apache, XAMPP, EasyPHP etc.) provide localhost.

So, as you told to use relative path, means for development purpoase there is no need to setup new website like I did for www.kie.ac.rw (Dummy web server) . Please correct me.

In that case, I will just use that kie folder as my website root directory and will give relative path like this:

kie/index.php                      (Directly under root foler "kie")
kie/notices.php                   (Directly under root foler "kie")
/kie/directorates/da.php     (Directorate of Administration)
/kie/directorates/df.php      (Directorate of Finance)
and so on...

Now, when I will put my kie folder in wwwroot foder (in IIS), or htdocs foder (in XAMPP), or EasyPHP foder in EasyPHP then to browse index.php, I will type this:

http://localhost/kie/index.php

But, in realtime, when I will give my "kie" root folder to ISP to host my web contents, how they will map it in the way that when anybody types http://kie.ac.rw (NOT http://kie.ac.rw/kie), they will redirect it to index.php automatically, when index.php is on kie folder.

In that case, should I directly put all my files in wwwroot (in htdocs in XAMPP) or I should make a folder and then put all the web contents there ?

Regards,

Hemant

0
 
giltjrCommented:
How your ISP maps to your directory will depend on what Web server they use.

Say they use Apache, they will most likely setup a virtual hosts kie.ac.rw and in that virtual host definition they will make the documentroot point to the correct directory based on your specs.  Most likely "/something/something/kie".  Then when somebody goes to the host http://kie.ac.rw Apache will present them with the file "/something/something/kie/index.php"
0
 
JatinHemantAuthor Commented:
Thanks for your kind support.

Just to be on the safe side, I would again ask...

There will be no problem na...if I use localhost for development phase with all the relative paths.

Regards,

Hemant
0
 
giltjrCommented:
Nope.  Although I don't do a lot of web stuff, I generally use localhost for dev and the real host name when I migrate it to production.
0
 
JatinHemantAuthor Commented:
Thanks for your continuous support.

Best regards,

Hemant
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now