我想将所有具有 .html 扩展名的链接重定向到一个 process.php 文件,其中目录+页面名称作为 get 参数。我已经尝试过这些link1 link2解决方案,但它不起作用。
例如
http://localhost/Site/directory1/test1.html
http://localhost/Site/directory2/test2.html
重定向到 process.php 作为
http://localhost/Site/process.php?directory1/test1.html
http://localhost/Site/process.php?directory2/test2.html
我试过这样。
RewriteEngine on
RewriteRule ^/(.*).html /process.php?page=$1
还有这个
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^(.*/)?([^/]*)\.php$ /process.php?page=$2 [R=301,L]
但它不起作用。
请查看并建议任何可能的方法来做到这一点。