Discussion Forums  >  Grunts, Groans, Complaints

Replies: 14    Views: 4679

Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
08/24/14 04:18 PM (9 years ago)

.html vs. .htm

Hello all, I've been working on making my app ready to be distributed for free. It is currently an iPhone paid app. Instead of creating an Android app, I've decided to make a mobile friendly web site to look like my app. My app is basically a few hundred food menus with simple menus holding them together. All of my food menus are on my server and are .html files. This works great for the iOS app and if I type the URL to the file in my laptop browser, it shows up fine. The kicker is when I type the URL into my iPhone browser. Safari to Chrome. I get a 404 page not found screen. However, if I change the file to .htm and then type the new URL in my mobile browser, it works. iPhone 5 iOS 7.1.2 My questions are: Why won't a URL ending in .html work in a mobile browser but .htm will? Does anyone see a problem with changing all of my menu files from .html to .htm? Thanks Dave
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/24/14 04:26 PM (9 years ago)
I could say a lot on this, but I'll summarize it this way: 1) I don't know why; I thought it did, or at least it should. 2) No, I don't see a problem. Cheers! -- Smug
 
Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
like
08/24/14 04:33 PM (9 years ago)
Hmmmm. Thanks Smug You can load url's on your iPhone ending in .html?
 
Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
like
08/24/14 04:34 PM (9 years ago)
Oh wait, I see, answers 1and 2. Sorry Smug. Disregard that last question. Thanks Dave
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
08/24/14 04:36 PM (9 years ago)
In safari, yes. Cheers! -- Smug
 
xparte
Aspiring developer
Profile
Posts: 50
Reg: May 08, 2012
location unknow...
2,450
like
08/24/14 09:12 PM (9 years ago)
There's no difference between the 2 extensions, one was just used back in the 8.3 file format days. .html files work in both browsers on iOS. Do you have a URL as an example?
 
Nicks App
Code is Art
Profile
Posts: 426
Reg: May 21, 2014
Las Vegas
6,010
like
08/25/14 08:15 AM (9 years ago)
That is a very strange question/scenario. A URL is what a URL is. If the source document is .htm, then the only way to access it, is to type it in the web browser as .htm. If the source document is .html, then the only way to access it, is to type it in the web browser as .html. Vice versa will result in 404. If the source document is ,html, and you type .htm, it isn't going to open. Unless you have a .htaccess file, that is doing some kind of redirecting based on detection of a mobile device. http://www.inmotionhosting.com/support/website/redirects/mobile-redirect
 
Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
like
08/25/14 09:47 AM (9 years ago)
Nicks App, thank you. I blocked a couple mobile rules that must have been default from Hostgator and it worked fine. I don't know anything about .htaccess files other than the basics. I DISABLED THE 9TH AND 10TH LINES UP FROM THE BOTTOM AND I AM ABLE TO LOAD URL'S ENDING IN .HTML ON MY MOBILE DEVICE NOW Can someone explain what these mobile rules do and if I'm putting my files in harms way by disabling the 2 lines below. Thanks again Nicks App! My file looks like: RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://mydomain.com$1 [R=301,L] #Weebly Additions Start DirectoryIndex index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm home.htm default.htm index.fcgi ErrorDocument 404 /404.php ErrorDocument 403 /404.php Options -Indexes # Send send no-cache headers for root (/) and (.html) files SetEnvIf Request_URI "(^/|\.html)$" HTML_FILE Header add Pragma "no-cache" env=HTML_FILE Header add Cache-Control "no-cache, no-store, max-age=0, must-revalidate" env=HTML_FILE Header add Expires "-1" env=HTML_FILE RewriteEngine On # stop condition RewriteRule ^mobile/.*$ - [L] #Redirect urls based on a query string parameter RewriteCond %{QUERY_STRING} ^(.*&)?view=mobile([^&]*)&?(.*)?$ RewriteRule ^(.*)$ /$1?m%1%3 [CO=is_mobile:1:%{HTTP_HOST},CO=disable_mobile:0:%{HTTP_HOST},L,R] RewriteCond %{QUERY_STRING} ^m*(.*&)?view=full([^&]*)&?(.*)?$ RewriteRule ^(.*)$ /$1?%1%3 [CO=disable_mobile:1:%{HTTP_HOST},L,R] # only process HTML files # ---------------------------------------------------- RewriteRule (^|\.html)$ - [S=1] # is an html file, start the tests... RewriteRule .* - [S=9] # NOT html file, skip past mobile rules... # tests # ---------------------------------------------------- RewriteCond %{QUERY_STRING} ^mobile$ RewriteRule ^(.*)$ /$1?m [CO=is_mobile:1:%{HTTP_HOST},CO=disable_mobile:0:%{HTTP_HOST},L,R] # set cookies, redirect... RewriteCond %{QUERY_STRING} ^full$ RewriteRule ^(.*)$ /$1? [CO=disable_mobile:1:%{HTTP_HOST},L,R] # set cookies, redirect... RewriteCond %{HTTP_COOKIE} (^|;)\s*is_mobile=0 RewriteRule .* - [S=6] # skip past mobile rules... RewriteCond %{HTTP_COOKIE} (^|;)\s*disable_mobile=1 RewriteRule .* - [S=5] # skip past mobile rules... RewriteCond %{HTTP_COOKIE} (^|;)\s*is_mobile=1 RewriteRule .* - [S=2] # go to mobile rules... RewriteCond %{HTTP_USER_AGENT} android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge\ |maemo|midp|mmp|opera\ m(ob|in)i|palm(\ os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows\ (ce|phone)|xda|xiino [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a\ wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r\ |s\ )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1\ u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(\ i|ip)|hs\-c|ht(c(\-|\ |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(\ |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(\ |\/)|klon|kpt\ |kwc\-|kyo(c|k)|le(no|xi)|lg(\ g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-|\ |o|v)|zz)|mt(50|p1|v\ )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v\ )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|\ )|webc|whit|wi(g\ |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-) [NC] RewriteRule .* - [CO=is_mobile:1:%{HTTP_HOST},S=1] # go to mobile rules... RewriteRule .* - [CO=is_mobile:0:%{HTTP_HOST},S=2] # set cookie, skip past mobile rules... # mobile rules # ---------------------------------------------------- #RewriteRule ^$ /mobile/index.html [S=1,PT] I DISABLED THIS LINE #RewriteRule ^(.*)$ /mobile/$1 [PT] I DISABLED THIS LINE #Weebly Additions End # Use PHPcur as default AddHandler application/x-httpd-phpcur .php <IfModule mod_suphp.c> suPHP_ConfigPath /opt/phpcur/lib </IfModule> RewriteEngine On RewriteRule ^Microsoft-Server-ActiveSync$ hgpush/index.php
 
Nicks App
Code is Art
Profile
Posts: 426
Reg: May 21, 2014
Las Vegas
6,010
like
08/25/14 10:18 AM (9 years ago)
I wrote my first computer program in 1972, and even then, they told us to be very careful using "ALTER" statements! I use .htacess files pretty much only to help with SEO. If I have a PHP script, with e.g. ?id=555 tag for item 555 in my SQL table, .htaccess allows me to create a fake "URL": http://www.MyDomain.com/Product-Google-will-take-an-interest-in.php which redirects to http://www.MyDomain.com/products.php?id=555 I know IT people live in dark boxes with no daylight, who think .htaccess files should get involved with detecting mobile devices, but there are other ways - if necessary or not. If one is really concerned about desktop/phone/tablet, there are fields in the $_SERVER array which can tell you interesting things about the web surfer who is presently viewing your page - and what their equipment is. In PHP, do a print '<pre>'.print_r($_SERVER,true).'</pre><p>'; Fascinating reading. I save $_SERVER data to a log file each time a surfer surfs in. I don't do .asp, but you can Google the .asp equivalent command and syntax.
 
Nicks App
Code is Art
Profile
Posts: 426
Reg: May 21, 2014
Las Vegas
6,010
like
08/25/14 10:20 AM (9 years ago)
BTW - If the Father of the Internet is Dr Benton Cerf, why do we call web page visitors "Surfers"? Shouldn't it be "Cerfers"?
 
Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
like
08/25/14 10:27 AM (9 years ago)
Nice! Thanks Nicks App. Basically I can remove the .htaccess file from my server without a problem or security flaw showing up correct? Dave
 
Nicks App
Code is Art
Profile
Posts: 426
Reg: May 21, 2014
Las Vegas
6,010
like
08/25/14 10:38 AM (9 years ago)
There doesn't seem to be anything related to "security" in your .htaccess file. Just - or mostly - mobile detect. I'd keep a copy somewhere safe if removing it from your hosting account. And I would check from time to time, to make sure it doesn't grow back on its own! You might have to remove the '.' dot if saving on your desktop computer. Maybe WIN is less concerned about '.' files, than OSX.
 
Nicks App
Code is Art
Profile
Posts: 426
Reg: May 21, 2014
Las Vegas
6,010
like
08/25/14 11:30 AM (9 years ago)
My comment above reminded me that I have a .html page, already published, the URL link is contained in e-mails to clients/customers... I wanted to get at the $_SERVER info, but .html can't, and the javascript looked to be more trouble than it's worth. <iframe> works! <iframe name="myiframe" src="****my****.php" style="width:0px; height:0px;"></iframe> My ****my****.php file has the print '<pre>'.print_r($_SERVER,true).'</pre><p>'; line of code. e.g. You can fiddle with that to make it as simple or complex as you want. (In practice, I actually save $_SERVER to a disk file, not print it publicly.) You can also: go to http://www.phpfiddle.net in CodeSpace tab <?php print '<pre>'.print_r($_SERVER,true).'</pre><p>'; ?> Then click on Run - F9 A new page will appear - You can see what you look like in a mirror.
 
Nicks App
Code is Art
Profile
Posts: 426
Reg: May 21, 2014
Las Vegas
6,010
like
08/25/14 11:33 AM (9 years ago)
phpfiddle.org doesn't employ word wrap, but if you scroll to the right [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 You can see your browser... and HTTP_USER_AGENT will also give clues as to phone or tablet.
 
Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
like
08/25/14 12:04 PM (9 years ago)
Awesome! Thanks for the help Nicks App. It saves me from changing 300+ .html docs to .htm. Dave
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.