开发者

Apache mod_rewrite help?

开发者 https://www.devze.com 2023-04-03 07:52 出处:网络
I want to rewrite requests like: mydomain.com/this/is/a/test to: mydomain.com/url.php?i=this,is,a,t开发者_JAVA技巧est

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消