Forum Moderators: phranque
--Then redirect them to go_here.htm or http://www.example.com--
Thanks.
I read some of the rules while browsing some of the other posts and didn't know I needed to make an attempt at coding. Sorry. Here's what I've come up with. But I get a '500 Internal Server Error' with this.
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^*\.swf$ http:www.go_here.com [R=301,L]
and it works. Oh, happy day!
But...now if I call the game in the normal way --http://mysite.com/game.htm-- the rewrite rule does something concerning the swf file, I'm not sure what. But the rewrite rule causes the swf to not load. Is there a solution for this? Thanks again.
[edited by: chasmcg at 1:02 am (utc) on June 18, 2007]
[edited by: jdMorgan at 1:35 am (utc) on June 19, 2007]
[edit reason] example.com [/edit]
[edited by: jdMorgan at 1:35 am (utc) on June 19, 2007]
[edit reason] example.com [/edit]
RewriteRule ^(([^.]+\.)+)swf$ http://www.example.com/$1htm [R=301,L]
Jim
http://example.com/game.htm
http://example.com/swf/game.swf
You have this to redirect to the same directory.
http://www.example.com/$1htm [R=301,L]
How would I code the line above to go back (up) one directory? Thanks again.
[edited by: jdMorgan at 1:36 am (utc) on June 19, 2007]
[edit reason] example.com [/edit]
Thanks Vince for the reply. I tried that along with ../../ and it doesn't work for me. It works in the sense that it goes back 1 directory (or 2 with ../../) but it always has the swf/game.htm included. I can't seem to lose the swf directory no matter what I try.
Vince, the last line of code works. Thanks a lot!
Seems you solve a problem for me and I discover another one. I notice that if I implement the code above when the swf file is not in the browser cache, the code works. If the swf file is in the cache, it doesn't. But it does exactly what I was wanting, so again, thanks a lot for all your help.
Speaking of slowdown. I may try to implement a lot of server-side includes on my site. Google is telling me I can't serve their ads in iframes. I have iframes all over my site and will have to do something or Google will suspend me. I already have some SSIs in a few shtml files but want to use them with a .htaccess file. This will keep from having to rename all my files to shtml and screw up all my links to them. I've read about the code below to add to a .htaccess file but I'm concerned about the slowdown and the parsing.
"AddType text/html .shtml .shtm .htm .html"
"AddHandler server-parsed .shtml .shtm .htm .html"
How bad will that slow down my server? Or is there a better way to do SSIs without renaming all of the files to shtml? Thanks.
Another way to selectively enable SSI parsing on text/html pages is to use the XBitHack directive in Apache mod_includes. With XBitHack enabled, the server will examine the X-bit (eXecute permissions bit) of each html file. If the bit is set, the file will be parsed for SSI. If not, it is handled as a static page and no parsing is done.
See Apache mod_includes for the details.
Jim
With SSI parsing enabled, the server has to read through the file and look for a "<!--#" sequence marking an SSI directive, then process that directive, and resume looking for another, repeating until the end-of-file is reached.
But the SSI directives are usually very simple, and since SSI is so "mature," the functions are fairly-well optimized.
So, although there are dire warnings about server performance degradation, we need to remember that this stuff was written when CPUs were ten thousand times slower and memory a million times smaller. There are many, many, really-big sites today built entirely on PHP and similar server-side scripting languages, and PHP is certainly no faster to parse than SSI is...
Before abandoning the XBitHack approach, take a long look at the effects that both methods have on the Last-Modified server response header. With XBitHack, you can retain Last-Modified functionality, whereas with straight .shtml, you cannot. This affects the cacheability of your pages, and ultimately, your server load.
Jim
RewriteRule ^swf/([^.]+)\.swf$ http://www.example.com/$1.htm [R=301,L]
Jim
That would mean that those who have it cached AND are opening it from the HTML page will not be forced to reload it.
[edited by: jdMorgan at 12:16 pm (utc) on June 20, 2007]
[edit reason] Fix typo. [/edit]