mod rewrite everything after domain into get

前端 未结 3 1031
情歌与酒
情歌与酒 2021-01-27 12:24

How can I rewrite everything after the domain name into get if it is not already get?

For example : example.com/blah/blah.blah

will become example.com/?blah/blah

3条回答
  •  太阳男子
    2021-01-27 13:02

    Quite simply use variable %{REQUEST_URI} as a query parameter:

    Options +FollowSymlinks -MultiViews
    RewriteEngine on
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/index.php$ [NC]
    RewriteRule . /index.php?%{REQUEST_URI} [L,QSA]
    

提交回复
热议问题