Kenjun

July 21, 2008

RewriteRule

Filed under: Uncategorized — kenjun @ 9:59 am

RewriteRule:
Syntax: RewriteRule Pattern Substitution

Here’s an example you could use in a .htaccess file:
RewriteRule ^(.*)$ /index.php/$1 [L]
which says if you have a URL like this:
/wordA/wordB/wordC
then replace it with
/index.php//wordA/wordB/wordC

where the not very user-friendly [L] flag means “stop processing”:
‘last|L’ (last rule)
Stop the rewriting process here and don’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 (‘/’) to a real one, e.g., ‘/e/www/’.

See here for more details:
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

Advertisements

Create a free website or blog at WordPress.com.

%d bloggers like this: