MyBB Community Forums

Full Version: need htaccess help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
hey, i am a htaccess N00b Toungue

basically, a me and a few members have done a banner exchange, however i want to be able to display a variety of different banners on their site, all advertising mine, but in different colours and such

Now, i dont really wanna PM them all and ask them to change the site. Instead, i plan on making the image they are linking to ( http://dev-network.com/images/banners/devnet.gif ) actually display http://dev-network.com/ad.php Smile The ad.php will then randomly generate an ad banner advertising my site in different ways.

Thus if i ever need to change the banner, i can leave the old one in and add more to it. instead of having 1 static banner across all the sites Big Grin


Any ideas.
This doesn't have anything to do with htaccess..?
My suggestion is to use MIME types.

AddHandler application/x-httpd-php5 .gif

That would allow you to execute .gif files as .php, so you can make a file "ad.gif" and then in it you can put a PHP randomizer code.
You can try this for your htaccess file. It's just a simple mod_rewrite code.
RewriteEngine On
RewriteRule banner.png ad.php

This will basically allow you to use "banner.png" the same as you would "ad.php". Each time you refresh the page (using banner.png), it will change.
(2010-08-31, 08:19 PM)pyridine Wrote: [ -> ]This doesn't have anything to do with htaccess..?

Really? How so?


(2010-08-31, 08:30 PM)Zash Wrote: [ -> ]My suggestion is to use MIME types.

AddHandler application/x-httpd-php5 .gif

That would allow you to execute .gif files as .php, so you can make a file "ad.gif" and then in it you can put a PHP randomizer code.

I don't really wanna let people upload and execute gifs as php files Smile




(2010-08-31, 08:37 PM)Dutchcoffee Wrote: [ -> ]You can try this for your htaccess file. It's just a simple mod_rewrite code.
RewriteEngine On
RewriteRule banner.png ad.php

This will basically allow you to use "banner.png" the same as you would "ad.php". Each time you refresh the page (using banner.png), it will change.

Thank you Wink
and then you can get validation errors and "content delivered as image/gif but interpreted as php" or something like that.

may not be an issue for transitional type though
(2010-08-31, 08:47 PM)Tommyk Wrote: [ -> ]
(2010-08-31, 08:30 PM)Zash Wrote: [ -> ]My suggestion is to use MIME types.

AddHandler application/x-httpd-php5 .gif

That would allow you to execute .gif files as .php, so you can make a file "ad.gif" and then in it you can put a PHP randomizer code.

I don't really wanna let people upload and execute gifs as php files Smile
Technically then, for the actual advertisement code, put it in its own directory and put the .htaccess in that directory so that the MIME will only affect that file.
header('Content-type: image/gif');

?
I don't think you fully understood my question Wink
How come my solution won't work?
Pages: 1 2