<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vex Star &#187; rule processing</title>
	<atom:link href="http://www.vexstar.com/tag/rule-processing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vexstar.com</link>
	<description>Computers and Programming</description>
	<lastBuildDate>Tue, 21 Jun 2011 01:52:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Website &#8216;Media Player&#8217;</title>
		<link>http://www.vexstar.com/website-media-player/</link>
		<comments>http://www.vexstar.com/website-media-player/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 18:55:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[A-Z]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[avi]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[operating systems]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[rule processing]]></category>
		<category><![CDATA[then processing]]></category>
		<category><![CDATA[translator]]></category>
		<category><![CDATA[USD]]></category>
		<category><![CDATA[windows media player plugin]]></category>

		<guid isPermaLink="false">http://www.vexstar.com/website-media-player/</guid>
		<description><![CDATA[Do any of you know if it is possible to make it so if any .wmv / .avi file is clicked on my website, it is automatically loaded either in that window, or in a popup.. instead of prompting user to download?
People upload files to my website, and want to be able to play the [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Do any of you know if it is possible to make it so if any .wmv / .avi file is clicked on my website, it is automatically loaded either in that window, or in a popup.. instead of prompting user to download?</p>
<p>People upload files to my website, and want to be able to play the videos right on the site.. instead of having to download.</p>
<p>how the browser deals with .wmv/.avi files is up to the browser and the operating systems default file types.  instead of linking directly to the file you can either embed it in the current page or you can have a javascript link that opens a new window with the file embedded in the popup.<br /><span id="more-209"></span><br />i was hoping there may be a chance i could manipulate the way my website handles any url with *.wmv* in it.. maybe using the .htaccess&#8230; heh&#8230; guess i&#8217;ll have to do things the hard (right) way&#8230;</p>
<p>thanks<br />well you can link to a script that will output different headers and change the content-type while keeping the file as a wmv but that just helps the browser and OS know what to do with it.  examples with php here: </p>
<p>ya but if you actually want it to play inside the browser you&#8217;ll have to embed it.<br />short of using a windows media player plugin, java applet, or flash you can&#8217;t guarantee that function.  In the end, the browser decides how to handle it.<br />Use .htaccess to pass it through a PHP file that will properly embed it.
<div style="5px;">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td class="alt2" style="1px inset">
<div></div>
</td>
</tr>
</table>
</div>
<p>That&#8217;s what I am going to try do do.. </p>
<p>[edit] i sucks, read next post [/edit]<br />Okie Dokie&#8230; I&#8217;m a little stuck (and off to bed so I have given up until tomorrow night after work)</p>
<p>Dumpy: (or anybody) &#8230; embedding into a php file is easy.. manually&#8230; how can I make it so clicking on &#8216;mysite.com/uploaded/ai2a/funnylol.avi&#8217; will be rewritten to say&#8230; &#8216;mysite.com/streaming/video.php&#8217; with the &#8216;funnylol.avi&#8217; video embedded into it&#8230;</p>
<p>Or is that too dificult / too much work / not possible?<br />You want flash video, man.  Its REALLY easy to create a playable .swf (flash) video if you have .flv video, or any kind of video for that matter.  Get Flash (the program) and create videos to embed.  It will even output the HTML to embed them for you, and you can easily set options for the player like audio controls, FF/rewind, etc.</p>
<p>Otherwise you just want to embed the video file in HTML.  You do not need PHP.</p>
<p>Do this: &lt;EMBED SRC=&quot;filename.???&quot;&gt;&lt;/EMBED&gt;</p>
<p>Look up the EMBED HTML docs.</p>
<p>Here&#8217;s an example of some audio: &lt;embed width=&quot;200&quot; height=&quot;30&quot; src=&quot;http://dev.myapp.com/static/audio/bob/restaurant.wav&quot;/&gt;
<div style="5px;">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td class="alt2" style="1px inset">
<div></div>
<div style="italic">You want flash video, man.  Its REALLY easy to create a playable .swf (flash) video if you have .flv video, or any kind of video for that matter.  Get Flash (the program) and create videos to embed.  It will even output the HTML to embed them for you, and you can easily set options for the player like audio controls, FF/rewind, etc.</p>
<p>Otherwise you just want to embed the video file in HTML.  You do not need PHP.</p>
<p>Do this: &lt;EMBED SRC=&quot;filename.???&quot;&gt;&lt;/EMBED&gt;</p>
<p>Look up the EMBED HTML docs.</p>
<p>Here&#8217;s an example of some audio: &lt;embed width=&quot;200&quot; height=&quot;30&quot; src=&quot;http://dev.myapp.com/static/audio/bob/restaurant.wav&quot;/&gt;</p></div>
</td>
</tr>
</table>
</div>
<p>Converting to flv/swf is easy&#8230; my problem is I have people uploading .wmv, .avi, .mpg files, and I am trying to see if there is a way to redirect a direct URL if  to something like  &gt; video.php having code in it to grab that video and play it&#8230;</p>
<p>I think I am complicating things too much.
<div style="5px;">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td class="alt2" style="1px inset">
<div></div>
<div style="italic">Converting to flv/swf is easy&#8230; my problem is I have people uploading .wmv, .avi, .mpg files, and I am trying to see if there is a way to redirect a direct URL if  to something like  &gt; video.php having code in it to grab that video and play it&#8230;</p>
<p>I think I am complicating things too much.</p></div>
</td>
</tr>
</table>
</div>
<p>Then I suggest you read my post again, because I included instructions for embedding any kind of video using HTML.</p>
<p>I can embed&#8230; my issue was the video is being uploaded, and the url to the file will cause the browser (most likely) to download it&#8230;</p>
<p>I sort of figured this out&#8230; but I am having a problem&#8230;</p>
<p>I wanted when a user clicked , it to load in an embedded html/php file&#8230; </p>
<p>The easiest way to do this I figured was using .htaccess&#8230;</p>
<p>I have a php file that when combined with  &#8230; it plays it in the embedded page.</p>
<p>I then used a rewrite rule in .htaccess to rewrite the url  to &#8230;</p>
<p>Anyway&#8230; the video isn&#8217;t loading when it is redirected using the .htaccess!!</p>
<p>RewriteRule (.+).avi http://www.mysite.com/video.php?vid=$1.avi [QSA,L]</p>
<p>
*edited out website name because until i&#8217;m finished i dont want it published.<br />CLIFFS:</p>
<p>Embedded video = easy and works<br />
Rewriting link to video to the embedded link = easy? and no works&#8230; WtF<br />I posted this on another forum a while back (so I may not stand by the exact wording, but overall, it&#8217;s still accurate)&#8230;</p>
<p></p>
<div style="5px;">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td class="alt2" style="1px inset">
<div></div>
<div style="italic">
<div style="5px;">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td class="alt2" style="1px inset">
<div></div>
<div style="italic">
<div style="5px;">
<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td class="alt2" style="1px inset">
<div></div>
</td>
</tr>
</table>
</div>
<p>Could you please explain how this code works?? Im clueless.</p></div>
</td>
</tr>
</table>
</div>
<p>RewriteRule    </p>
<p>
Okay, this is put into your .htaccess file, but CD forgot to mention that you need to turn on the rewrite engine.</p>
<div style="5px">
<pre style="auto">Options +FollowSymlinks
RewriteEngine on</pre>
</div>
<p>Although, putting those in your .htaccess file may wind up being redundant if you&#8217;re on a shared server (since most shared hosts have already done it for you), it&#8217;s always good practice to do it since both commands MUST be passed in order for rewrite rules work.</p>
<p>Moving on&#8230;</p>
<p>RewriteRule </p>
<p> = Begining of regex phrase (verbatim)<br />
 = variable content<br />
 = End of regex phrase.<br />
To break it down even more, what that phrase is saying is &quot;Everything after  will be made into a variable (how to call the variable will be discussed in just a second). Of course, this is assuming your URL contains .</p>
<p> = variable. You use this to call the variable created from . </p>
<p> = just an example PHP with various GET options in the URL. Simply put, this can be anything your little heart desires. Another example would be:  (assuming you have a file named viewfile.php and it is set up to $_GET[&quot;file&quot;]).</p>
<p> = No Case (case insensitive)<br />
 = Last (last flag)</p>
<p>
So here&#8217;s another example:</p>
<div style="5px">
<pre style="auto">Options +FollowSymlinks
RewriteEngine on

RewriteRule ^files/(.+)$ view.php?file=$1 [NC,L]</pre>
</div>
<p>Everything that is in the directory &quot;files&quot; will be passed through view.php for processing. Obviously in here, I can put a border, create a HTML page, throw in some ads, etc.</p>
<p>Love Always,<br />
Dumpy Dooby</div>
</td>
</tr>
</table>
</div>
<p>
So in your case, you&#8217;re going to want to go with:</p>
<div style="5px">
<pre style="auto">Options +FollowSymlinks
RewriteEngine on

RewriteRule ^<b>videos</b>/(.+)$ videos.php?view=$1 [R,L]</pre>
</div>
<p>That&#8217;s assuming your videos are contained in the <i>videos</i> subdirectory.</p>
<p>
I noticed one funny thing about my post: I used [NC,L], which is contradictory. Like I put above, you&#8217;ll want to go with [<b>R</b>edirect,<b>L</b>ast rule].</p>
<p>
Here is the information on flags from Apache []:<br />
<blockquote>Additionally you can set special flags for       <i>Substitution</i> by appending<br />
<blockquote>         <b>[<i>flags</i>]</b>       </p></blockquote>
<p>as the third argument to the RewriteRule       directive. <i>Flags</i> is a comma-separated list of the       following flags:
<ul>
<li>           &#8216;<b>redirect|R           [=<i>code</i>]</b>&#8216; (force <b>r</b>edirect)<br />
           Prefix <i>Substitution</i> with           [:thisport]/ (which makes the           new URL a URI) to force a external redirection. If no           <i>code</i> is given a HTTP response of 302 (MOVED           TEMPORARILY) is used. If you want to use other response           codes in the range 300-400 just specify them as a number           or use one of the following symbolic names:           temp (default), permanent,           seeother. Use it for rules which should           canonicalize the URL and give it back to the client,           <i>e.g.</i>, translate &#8220;/~&#8221; into           &#8220;/u/&#8221; or always append a slash to           /u/<i>user</i>, etc.<br />
                       <b>Note:</b> When you use this flag, make           sure that the substitution field is a valid URL! If not,           you are redirecting to an invalid location! And remember           that this flag itself only prefixes the URL with           [:thisport]/, rewriting           continues. Usually you also want to stop and do the           redirection immediately. To stop the rewriting you also           have to provide the &#8216;L&#8217; flag.</li>
<li>&#8216;<b>forbidden|F</b>&#8216; (force URL         to be <b>f</b>orbidden)<br />
         This forces the current URL to be forbidden,         <i>i.e.</i>, it immediately sends back a HTTP response of         403 (FORBIDDEN). Use this flag in conjunction with         appropriate RewriteConds to conditionally block some         URLs.</li>
<li>&#8216;<b>gone|G</b>&#8216; (force URL to be         <b>g</b>one)<br />
         This forces the current URL to be gone, <i>i.e.</i>, it         immediately sends back a HTTP response of 410 (GONE). Use         this flag to mark pages which no longer exist as gone.</li>
<li>           &#8216;<b>proxy|P</b>&#8216; (force           <b>p</b>roxy)<br />
           This flag forces the substitution part to be internally           forced as a proxy request and immediately (<i>i.e.</i>,           rewriting rule processing stops here) put through the . You have to make           sure that the substitution string is a valid URI           (<i>e.g.</i>, typically starting with           ) which can be           handled by the Apache proxy module. If not you get an           error from the proxy module. Use this flag to achieve a           more powerful implementation of the  directive,           to map some remote stuff into the namespace of the local           server.             Notice: To use this functionality make sure you have           the proxy module compiled into your Apache server           program. If you don&#8217;t know please check whether           mod_proxy.c is part of the &#8220;httpd           -l&#8221; output. If yes, this functionality is           available to mod_rewrite. If not, then you first have to           rebuild the &#8220;httpd&#8221; program with mod_proxy           enabled.</li>
<li>&#8216;<b>last|L</b>&#8216;         (<b>l</b>ast rule)<br />
         Stop the rewriting process here and don&#8217;t apply any more         rewriting rules. This corresponds to the Perl         last command or the break command         from the C language. Use this flag to prevent the currently         rewritten URL from being rewritten further by following         rules. For example, use it to rewrite the root-path URL         (&#8216;/&#8217;) to a real one, <i>e.g.</i>,         &#8216;/e/www/&#8217;.</li>
<li>&#8216;<b>next|N</b>&#8216;         (<b>n</b>ext round)<br />
         Re-run the rewriting process (starting again with the         first rewriting rule). Here the URL to match is again not         the original URL but the URL from the last rewriting rule.         This corresponds to the Perl next command or         the continue command from the C language. Use         this flag to restart the rewriting process, <i>i.e.</i>,         to immediately go to the top of the loop.<br />
         <b>But be careful not to create an infinite         loop!</b></li>
<li>&#8216;<b>chain|C</b>&#8216;         (<b>c</b>hained with next rule)<br />
         This flag chains the current rule with the next rule         (which itself can be chained with the following rule,         <i>etc.</i>). This has the following effect: if a rule         matches, then processing continues as usual, <i>i.e.</i>,         the flag has no effect. If the rule does         <b>not</b> match, then all following chained         rules are skipped. For instance, use it to remove the         &#8220;.www&#8221; part inside a per-directory rule set         when you let an external redirect happen (where the         &#8220;.www&#8221; part should not to occur!).</li>
<li>         &#8216;<b>type|T</b>=<i>MIME-type</i>&#8216;         (force MIME <b>t</b>ype)<br />
         Force the MIME-type of the target file to be         <i>MIME-type</i>. For instance, this can be used to         simulate the mod_alias directive         ScriptAlias which internally forces all files         inside the mapped directory to have a MIME type of         &#8220;application/x-httpd-cgi&#8221;.</li>
<li>           &#8216;<b>nosubreq|NS</b>&#8216; (used only if           <b>n</b>o internal           <b>s</b>ub-request)<br />
           This flag forces the rewriting engine to skip a           rewriting rule if the current request is an internal           sub-request. For instance, sub-requests occur internally           in Apache when mod_include tries to find out           information about possible directory default files           (index.xxx). On sub-requests it is not           always useful and even sometimes causes a failure to if           the complete set of rules are applied. Use this flag to           exclude some rules.<br />
                       Use the following rule for your decision: whenever you           prefix some URLs with CGI-scripts to force them to be           processed by the CGI-script, the chance is high that you           will run into problems (or even overhead) on           sub-requests. In these cases, use this flag.</li>
<li>&#8216;<b>nocase|NC</b>&#8216;         (<b>n</b>o <b>c</b>ase)<br />
         This makes the <i>Pattern</i> case-insensitive,         <i>i.e.</i>, there is no difference between &#8216;A-Z&#8217; and         &#8216;a-z&#8217; when <i>Pattern</i> is matched against the current         URL.</li>
<li>&#8216;<b>qsappend|QSA</b>&#8216;         (<b>q</b>uery <b>s</b>tring         <b>a</b>ppend)<br />
         This flag forces the rewriting engine to append a query         string part in the substitution string to the existing one         instead of replacing it. Use this when you want to add more         data to the query string via a rewrite rule.</li>
<li>           &#8216;<b>noescape|NE</b>&#8216;           (<b>n</b>o URI <b>e</b>scaping of           output)<br />
           This flag keeps mod_rewrite from applying the usual URI           escaping rules to the result of a rewrite. Ordinarily,           special characters (such as &#8216;%&#8217;, &#8216;$&#8217;, &#8216;;&#8217;, and so on)           will be escaped into their hexcode equivalents (&#8216;%25&#8242;,           &#8216;%24&#8242;, and &#8216;%3B&#8217;, respectively); this flag prevents this           from being done. This allows percent symbols to appear in           the output, as in      RewriteRule /foo/(.*) /bar?arg=P1%3d$1 [R,NE]</p>
<p>          which would turn &#8216;/foo/zed&#8217; into a safe           request for &#8216;/bar?arg=P1=zed&#8217;.                                         <b>Notice:</b> The               noescape flag is only available with               Apache 1.3.20 and later versions.</li>
<li>           &#8216;<b>passthrough|PT</b>&#8216;           (<b>p</b>ass <b>t</b>hrough to next           handler)<br />
           This flag forces the rewriting engine to set the           uri field of the internal           request_rec structure to the value of the           filename field. This flag is just a hack to           be able to post-process the output of           RewriteRule directives by           Alias, ScriptAlias,           Redirect, <i>etc.</i> directives from           other URI-to-filename translators. A trivial example to           show the semantics: If you want to rewrite           /abc to /def via the rewriting           engine of mod_rewrite and then           /def to /ghi with           mod_alias:      RewriteRule ^/abc(.*)  /def$1 [PT]<br />
    Alias       /def       /ghi</p>
<p>          If you omit the PT flag then           mod_rewrite will do its job fine,           <i>i.e.</i>, it rewrites uri=/abc/&#8230; to           filename=/def/&#8230; as a full API-compliant           URI-to-filename translator should do. Then           mod_alias comes and tries to do a           URI-to-filename transition which will not work.             Note: <b>You have to use this flag if you want to           intermix directives of different modules which contain           URL-to-filename translators</b>. The typical example           is the use of mod_alias and           mod_rewrite..</li>
<li>&#8216;<b>skip|S</b>=<i>num</i>&#8216;         (<b>s</b>kip next rule(s))<br />
         This flag forces the rewriting engine to skip the next         <i>num</i> rules in sequence when the current rule         matches. Use this to make pseudo if-then-else constructs:         The last rule of the then-clause becomes         skip=N where N is the number of rules in the         else-clause. (This is <b>not</b> the same as the         &#8216;chain|C&#8217; flag!)</li>
<li>         &#8216;<b>env|E=</b><i>VAR</i>:<i>VAL</i>&#8216;         (set <b>e</b>nvironment variable)<br />
         This forces an environment variable named <i>VAR</i> to         be set to the value <i>VAL</i>, where <i>VAL</i> can         contain regexp backreferences $N and         %N which will be expanded. You can use this         flag more than once to set more than one variable. The         variables can be later dereferenced in many situations, but         usually from within XSSI (via &lt;!&#8211;#echo         var=&quot;VAR&quot;&#8211;&gt;) or CGI (<i>e.g.</i>         $ENV{&#8216;VAR&#8217;}). Additionally you can dereference         it in a following RewriteCond pattern via         %{ENV:VAR}. Use this to strip but remember         information from URLs.</li>
</ul>
</blockquote>
<p></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.vexstar.com/website-media-player/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

