#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Nottingham, UK
    Posts
    3
    Rep Power
    0
    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?
  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>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

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Nottingham, UK
    Posts
    3
    Rep Power
    0
    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?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    166
    Rep Power
    15
    Why not just ask the user if they want Flash?

    You may wish to check usability studies at:
    http://www.useit.com/
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Nottingham, UK
    Posts
    3
    Rep Power
    0
    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 use of Flash in question is just to "pretty" up the navigation bar at the top with a few visual effects for rollovers, rather than reams of complicated Javascript. If anything, the speed of download will be about the same as using plain HTML (actually XHTML, as I am attempting to make the site work as far down as Lynx and braille browsers). I wanted to redirect automatically, so people aren't asked if they want to to use Flash just to make the site look nicer. There is actually nothing on the site that the lack of Flash will break, or the user will even miss. It's just there as a small amount of "eye candy" for those who have capable browsers. Its use is so that users don't dismiss the design as being boring, like they do with amazon.com (which is, as far as I'm concerned, one of the best designed sites there is). The last thing I want, or need, is a Flash-only, Pentium XXX, 7GHz, 24" monitor, T3 connection, boo.com!

    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.

IMN logo majestic logo threadwatch logo seochat tools logo