Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- mod rewrite + MySQL = clean URIs


jdMorgan - 12:06 am on Jul 17, 2010 (gmt 0)


RewriteRule cannot see query strings, and your use of [index.php] was incorrect. [A-z] also probably won't work (uppercase A, lowercase z). Try something like this instead.

RewriteEngine on
RewriteLogLevel 9
RewriteLog "/var/log/rewrite.log"
RewriteMap newurl prg://var/www/cgi-bin/cleanurls.php
RewriteCond %{QUERY_STRING} ^([a-z0-9]+)=([a-z0-9]+)$ [NC]
RewriteRule ^/(index\.php)?$ ${newurl:%1/%2}? [L]

Note that using the [NC] flag with the [a-z] pattern makes the comparison case-insensitive and is 50% faster.

The rule pattern now matches requests for either example.com/index.php or just example.com/ (with appropriate query string appended). The back-references are now to the RewriteCond pattern matches.

Jim


Thread source:: http://www.webmasterworld.com/apache/4171842.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com