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.
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net