Apache mod_rewrite help?
I want to rewrite requests like:
mydomain.com/this/is/a/test
to:
mydomain.com/url.php?i=this,is,a,t开发者_JAVA技巧est
How can I write a rule that can handle this?
Create a .htaccess file with the below contents and place it in your root web directory.
RewriteEngine On
Options +Followsymlinks
RewriteRule (.*) url.php?i=$1
That would create a query string of this/is/a/test
instead of your requested comma-separated value; that's nothing a quick string-replace function (like str_replace()
in PHP) couldn't fix.
精彩评论