Jump to content

URL not ending with file name shows File Download dialog


yoyo

Recommended Posts

Hi there,

 

domain: http://yoyo.heliohost.org

cPanel username: yoyo

 

When I access my website as http://yoyo.heliohost.org then my web-browser shows a "File Download" Dialog but works fine if I access http://yoyo.heliohost.org/index.html. Same is the case for URL http://yoyo.heliohost.org/letsyo, works fine as http://yoyo.heliohost.org/letsyo/index.html. I want that if a fine name is not provided in the end of a URL then the web-server should automatically send the index.html file.

 

Another thing

In my HTML files I have embedded certain code (links) via PHP.

We can request the web-browser to process .html files as PHP files by adding the following line to .htaccess

AddType application/x-httpd-php .html

 

so that PHP tags embedded in HTML files can also be processed by the web-server before serving the requested HTML.

 

While this approach works fine with my other host it does not work here.

Try accessing http://yoyo.heliohost.org/letsyo/index.html, there should have been a top and side links bar. There is none.

Works fine if I rename my HTMLs with PHP code to PHP.

 

Please suggest the needful.

 

Thanks

Sukhjinder...

Link to comment
Share on other sites

Test Browser: K-Meleon 1.5

cPanel UserName: yoyo

Domain: yoyo.heliohost.org

 

Before renaming .htaccess to .ht (and adding some commands to it)

 

http://yoyo.heliohost.org/letsyo/index.html was working fine and http://yoyo.heliohost.org/letsyo/ was showing the "File Download" dialog. Now the behaviour is reversed.

 

Also I still don't know how to configure the web-server to process the PHP in my HTML files before serving them to the client web-browser. Hence all pages in the letsyo directory are showing up without the top and right links bar which are embedded via PHP code in my HTML pages.

 

I wish to move my website from my existing host to here.

 

The website should look like http://sukhjinder.cn and http://sukhjinder.cn/letsyo. My original host is migrating data to another server so the web-site shows the "Apache Test Page" sometimes. If you try visiting/refreshing the web-page a few times you might see how my site looks.

 

Thanks DJBob and everyone else.

Sukhjinder...

Link to comment
Share on other sites

Have the file end with .php and enclose your code in <?php and ?> tags.

 

Thanks DJBob. Due to certain reasons I dont want to rename my files from .HTML to .PHP. I've included the PHP code within correct tags in my HTMLs.

 

I found another option by creating An Apache Handler in cPanel here.

I clicked on the "Apache Handlers" icon then typed in "application/x-httpd-php" for .html but nothing changed.

 

Any other suggestions?

 

Thanks...

Link to comment
Share on other sites

Since adding handlers utilized the .htaccess file and I renamed the file earlier, the changes were not taking effect. Try adding "AddType application/x-httpd-php .html" to .htaccess in your public_html directory.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...