Page 1 of 1

ForceType versus mod_rewrite

Posted: Tue Aug 09, 2005 12:44 pm
by nielsene
This is slightly related to my Front Controller thread:

I'm trying to figure out the advantages/disadvantages of using ForceType versus mod_rewrite to generate clean URLs. (I'm leaving out the custom 404 method as I feel its polluting of the error log is a strong enough disincentive.)

I've been using ForceType so far, but one little details is making me want to explore mod_rewrite. Most tutorials I've seen only list one or the other and don't go into details as to their trade-offs.

Assuming you have sufficient control of httpd.conf and/or .htaccess, what are the pros/cons?

As I see it:
ForceType:
Pros: Simpler, less processing?
Cons: Extentionless scripts confuse phpDocumentor, configuration can get more psread out

and the flip for mod_rewrite.

Posted: Tue Aug 09, 2005 1:46 pm
by feyd
I'd tend to swing at mod_rewrite, because:
- more flexible, you could have it run a script to "help" determine the thing to send
- it's regex, I love regex, as you may know.

however:
- can be somewhat painful to deal with depending on what you want to do (unless you send everything through a script, then it can get a lot easier) :)

Dunno.

I'd say they are kinda even.

Posted: Fri Aug 12, 2005 7:57 am
by nielsene
feyd wrote:I'd tend to swing at mod_rewrite, because:
- more flexible, you could have it run a script to "help" determine the thing to send
What do you mean by this? Are you saying you can use mod_rewrite to direct all traffic through a single script? If so that's also true for the ForceType approach. If not, can you explain a little more of what you mean?

Posted: Fri Aug 12, 2005 8:08 am
by feyd
not only can you send all things through a script, you can send matched things through a script. So certain patterns can fluctuate which script they actually call if needed. Granted, you can kind of do that with ForceType as well.

Posted: Sat Aug 13, 2005 9:53 am
by Todd_Z
Can i see the .htaccess code for sending urls through a script with the mod_rewrite method? Sounds interesting.

Posted: Sat Aug 13, 2005 5:53 pm
by nthitz
Todd_Z wrote:Can i see the .htaccess code for sending urls through a script with the mod_rewrite method? Sounds interesting.
Heres a very simple one, and may not work depending on what your doing

Code: Select all

RewriteEngine on
RewriteRule !\.(gif|jpg|png|css|js)$  	/home/nthitz/public_html/index.php

Posted: Sat Aug 13, 2005 5:59 pm
by feyd
it's actually:
RewriteMap

look for prg as a MapType..

Posted: Sat Aug 13, 2005 11:32 pm
by nthitz
Well it works for me, so I dunno.

Posted: Sun Aug 14, 2005 11:17 pm
by Todd_Z
Yea, i use mod_rewrite all the time - i was curious about using the RewriteMap with php scripts