So let me clarify for myself (and others information, I guess). Apache web
server needs to have mod_rewrite installed to effectively handle the
requests, but I can just use PHP to rewrite the URLs via the $_SERVER
suprglobal, like this:

<pre>
$_SERVER[]
<?php print_r($_SERVER); ?>
</pre>

I will handle static file requests via the database and a record ID, which
ultimately returns the correct URL to the file to my application and
redirects in order to download the file. Am I on the right track? I'm sure I
just said something that is wrong.

On Tue, Apr 22, 2008 at 10:11 AM, Richard K Miller <[EMAIL PROTECTED]>
wrote:

>
> On Apr 22, 2008, at 9:43 AM, Wade Preston Shearer wrote:
>
>  Thank you. So Apache is where the rewrite needs to be done then?
> > >
> >
> > You can do it with PHP, but I recommend doing it with Apache. It can be
> > done in the httpd.conf file or in a .htaccess file. I would recommend an
> > .htaccess file as you do not have to restart Apache when you make changes
> > and it can be versioned. There is a setting in your httpd.conf that has to
> > be enabled for it to allow you to use a .htaccess file. Once that is
> > enabled, you place a plain text file in the root of your web directory
> > called ".htaccess" and put the rewrites in there. Google for "mod_rewrite"
> > and "rewriterule" and you will get plenty of examples.
> >
> > Here is an example (using the URL example in my earlier post) to get you
> > started:
> >
> > RewriteCond %{REQUEST_URI} ^/([a-z]*)/([0-9]*)$
> > RewriteRule ^/(.*)/(.*)$ /index.php?type=$1&id=$2 [NC,QSA,L]
> >
> >
> > The condition is optional. Most of the time you will want one so that
> > the rule is only executed if the condition is met. In this example, the
> > condition only matches URLs that are in the format…
> >
> > example.com/<alpha string>/<number>
> >
>
> I'm not sure you could do *any* URL rewriting without at least a bare
> minimum of mod_rewrite. This minimalist style is what WordPress does. The
> mod_rewrite rule for WordPress redirects all requests (except for static
> files) to /index.php which in turn parses the URL. You can choose from a
> variety of clean URL styles, without altering the mod_rewrite rules, because
> WordPress (PHP) handles the requests. If you change your URL style,
> WordPress will even redirect old links to new links.
>
>
>
>
>
>


-- 
Nathan Lane
Home, http://www.nathandelane.com
Blog, http://nathandelane.blogspot.com
_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to