将所有内容重定向到index.php

pix*_*xel 6 php redirect

我试图通过爆炸$_SERVER['REQUEST_URI']然后在结果之间切换来做干净的URL .

但是,一旦用户出门index.php,我假设我需要将它们重定向回来index.php以处理他们想要访问的URL.我怎么能做到这一点?

因此,例如,如果用户前往www.domain.com/home/johndoe/...我喜欢index.php(domain.com/index.php)被击中,以便它可以处理/home/johndoe/通过request_uri.

You*_*nse 19

的.htaccess:

RewriteEngine on
RewriteBase /
RewriteCond  %{REQUEST_FILENAME} !-f
RewriteCond  %{REQUEST_FILENAME} !-d
RewriteRule  ^(.*)$ index.php?param=$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)