How to redirect all requests to index.php and keep the other GET params?

后端 未结 2 1090
逝去的感伤
逝去的感伤 2020-12-03 21:23

Here\'s what I\'ve got so far:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !index.php
RewriteRule .* index.php?url=$0 [L]

But when I

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 22:16

    How about using the FallbackResource directive: "Define a default URL for requests that don't map to a file"

    
        FallbackResource /index.php
    
    

    That way you don't have to call the modRewrite module on every request.

    http://httpd.apache.org/docs/2.2/mod/mod_dir.html#fallbackresource

提交回复
热议问题