September 15th, 2000, 04:23 AM
I am trying to use mod_rewrite and .htaccess on a linux box to rewrite the uri the user sees in the location bar.
I am doing a check to see if flash is installed when the user first visits the site, using a small flash movie and php to redirect to the same page with a flagged variable.
The user types "http://www.domain.com" into his browser; the script then redirects him to "http://www.domain.com/index.htm?flash_installed=false" or "http://www.domain.com/index.htm?flash_installed=true". I would like the location bar in the browser to display both locations as "http://www.domain.com/" so that if he bookmarks the site he has to redo the test each time and can pass the url on to other people correctly.
I've tried all the mailing lists, documents, etc. I can think off, but the mod_rewrite and .htaccess documents on the apache site are so complicated I can't work out how to do this.
Can anyone help?
September 15th, 2000, 04:45 AM
>>I am trying to use mod_rewrite and .htaccess
Unfortunately, you can't do this with mod_rewrite nor .htaccess, everything has to take place within your php script.
1) .htaccess is the 1st file that gets read b4 your php file and your process must take place within your PHP script
2) You can't pass PHP variables back to .htaccess
3) Unlike REMOTE_HOST and others, there is no environment variable that check for plugin
September 15th, 2000, 05:10 AM
But isn't the .htaccess read again when the page is sent a second time?
The browser recieves index.htm. The flash/php does its check, and then does one of two things: use a meta-refresh tag to redirect to "index.htm?flash=no" if flash isn't installed, or to "index.htm?flash=yes" if it is. The "index.htm" page is then sent again with revised content and the variable echoed in the URI.
Can I not use .htaccess to rewite the URI the second time, to remove the echoed variable, or would a rewrite actually remove the variable before the php gets it?
Sorry I don't get this, but i'm not sure what mod_rewrite actually does; is it sending a the page that exists at the revised uri, or simply changing the file's uri after its been sent?
If I can't do it in .htaccess, is it possible to send a header in php that will display the revised uri when it send the page to the browser?
September 19th, 2000, 03:14 AM
Why not just ask the user if they want Flash?
You may wish to check usability studies at:
September 19th, 2000, 03:50 AM
I am very aware of usability; Jakob and his site are always in my mind when putting together a site, along with his excellent book right by my desk.
I do, however, feel that he is somewhat detached from the reality of the web, and that a little bit of flash never hurt anyone if it helps "sell" the message of the site.
<rant>I am extremely aware that a lot of design on the web is for other designers, and that many sites exclude many people. I hate this with a passion, wish the designers concerned would stop "ego wanking", and that the browsers would stick to standards.</rant>
The whole point of rewriting the URL is actually all about usability; I want to make sure that if they bookmark the page, or pass the URL on, they use the correct URL. I don't want non-flash users to go to the flash version and get a broken icon.
IMHO it is also better usability to detect what the browser is capable off and adjust to it, rather than have to present 20 questions before you get into the site. YMMV.
If, at the end of the day, I can't find a way to rewrite the URL I'll simply not bother with the Flash, and stick to XHTML and CSS.