开发者

Matching code with mod_rewrite

开发者 https://www.devze.com 2023-03-16 15:43 出处:网络
For my application, I want to match an URL with mod_rewrite such that the URL is passed directly to the file (index.php) through a GET request. This is my code:

For my application, I want to match an URL with mod_rewrite such that the URL is passed directly to the file (index.php) through a GET request. This is my code:

RewriteEngine On
RewriteRule ^(.*)$ index.php?q=$1

However开发者_Go百科, it's not working, and it appears to indeterminately rewrite it as "index.php?q=index.php". Could anyone enlighten me on this issue? Thanks.


RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?q=$1 [L]

try this one example

0

精彩评论

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

关注公众号