10th April, 2010
Since my original posts on mobile redirection in .htaccess files I’ve gotten some comments and emails asking for step-by-step guidance on exactly how to “install” these rules. I hope this post will answer some of those questions.
Before you continue reading, if you have php installed on your server, you may want to consider Andy Moore’s php based detection solution.
The Basics
First off, some basic requirements. You’ll need:
- Apache/Linux Hosting. Microsoft’s IIS has a completely different method for handling this sort of thing.
- FTP access.
- Apache mod_rewrite enabled. Depending on the type of hosting you have, it may be difficult to determine if you have this module installed and it may be impossible to enable if you don’t. If the steps below simply don’t seem to work, there is a good chance you don’t have mod_rewrite installed. Ask your tech support.
- Mobile site in a subdirectory, eg. www.yourdomain.com/m/. This set of rules I’ve posted will not work with a mobile subdomain.
The Steps
- Download mobilerules2.1.txt.
- Open the file in your favorite text editor, replace the 2 instances of “mobiledirectoryhere” (without quotes) with the directory name you are using for your mobile site. Save it.
- Open FTP client, enable ‘view hidden files’ – files beginning with a dot are hidden on linux. This option is typically buried in a “view” menu or something to that effect. Results may vary.
- Navigate to your site’s webroot (probably ‘htdocs’ or ‘www’).
-
- If there is already a .htaccess file present in the directory. Download it, open it in your favorite text editor. Copy & paste the contents ofmobilerules2.1.txt into the file. Save it, upload it.
- If there is no .htaccess file present. Upload mobilerules2.1.txt as is, rename it to .htaccess.
- Your Done. Test it from a mobile device.
If you have any questions please leave a comment.
Note: This script treats all opera mini, iphone and android the same as other phones and browsers. Leave some comments if you’d like me to address this.
apache mobile browser programming rewrite rule server in HowTo Tips
7th January, 2010
If you’re tired of websites resizing your browser window, rest your weary head. In Firefox, you can disable website’s abilities to do this with Javascript:
- Tools-> Options (Firefox -> preferences or ⌘, on OS X)
- Select the “Content” tab.
- Click on the “Advanced” button across from “Enable JavaScript”.
- Uncheck the “Move or resize existing windows” checkbox.
Thanks to reddit user libertao, another one of the many bits of knowledge I’ve learned from comments on reddit.
firefox in HowTo Tips
8th December, 2009
I found this post sitting in my drafts folder from earlier this year. Seeing as I haven’t updated the blog in awhile, I thought I’d finish off some of the sentences and hit the ‘publish’ button.
The newspaper industry is facing the perfect storm of declining readership, declining print ad sales, lackluster online ad revenues, the ever-present threat of blogs and the real-time web.
I had a Eureka! moment earlier today when I originally started this post, it occurred to me – newspapers could learn a lot from the Nine Inch Nails distribution model. In a nutshell, the NIN model concedes that music is free, instead of trying to charge people for something that already free, they charge fans for limited edition tangible goods: things like special run vinyl, signed copies of things, tee-shirts, etc.
A couple of ways I think the newspaper industry could add value to their dead tree version:
1) NO ads
2) ONLY distribute coupon type ads in print, don’t make them available online. Encourage advertisers to pay extra for these premium coupons.
3) Free stuff – throw in some tickets to stuff, maybe a glossy photo of scantily clad firefighters. Whatever the audience would apprieciate.
4) Allow subscribers to opt-in to receiving an email copy of their favorite section of the newspaper. An emailed copy would be easy to take with you on a mobile device like an iPhone without having to lug around a fat wad of paper.
I have no idea how the finances work out for any of these ideas. I just really think that if the print newspaper needs to survive, then publishers need to inject some value.
newspapers in HowTo Review
15th August, 2009
UPDATE: Some visitors are reporting that this works for Hulu as well.
The relationship between Comedy Central and Canada’s Comedy Network is the worst example of what can happen when rights owners assert copyright on the internet, based on national borders. If you are not aware – like Hulu, TV.com and others – Comedy Central videos will not play in Canada, but it’s worse. ComedyCentral.com – the entire domain – is unavailable to Canadian IPs! When you try visit it, you are redirected to comedynetwork.ca.
I found a workaround to this buried in a comment thread on reddit. Firefox users only:
For Canadian viewers, if you are using firefox, install the following addon:
http://addons.mozilla.org/en-US/firefox/addon/967 then:
1) In Firefox, Go to tools->modify headers
2) From the drop down box on the left select add
3) Then enter: “X-Forwarded-For” in the first input box without the quotation marks
4) Enter: “12.13.14.15″ in the second input box without the quotation marks
5) Leave the last input box empty, and save the filter, and enable it
http://imgur.com/Feb4.png
6) Click the ‘Configuration’ tab on the right then proceed to check the ‘always on’ button.
Close the Modify Headers box and it should work.
[orginal post]
Works like a charm!
in HowTo Tips Websites
17th July, 2009
When ordering lists of names or titles it’s sometimes desirable to exclude articles or other words from the order clause (eg. you want “The Burning Hell” to show up before “Great Lake Swimmers” in a list ordered by name). Early on in my career I must have assumed it was not possible and never bothered to look into again because I don’t recall ever ordering a list like this.
Anyways. Here’s how you do it:
SELECT name FROM artists ORDER BY TRIM( LEADING "a " FROM TRIM( LEADING "an " FROM TRIM( LEADING "the " FROM LOWER( name ) ) ) )
[thanks metafilter]
mysql php programming in HowTo