【发布时间】:2023-04-02 10:46:01
【问题描述】:
当用户输入网址时
http://example.com/app/abcd123/
我想显示他的页面
http://example.com/app/index.php?param=abcd123
无需更改浏览器中的 URL。
我把 .htaccess 文件放在 app 文件夹中,里面有代码
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/index.php [NC]
RewriteCond %{QUERY_STRING} ^param=(.*)
RewriteRule (.*) http://example.com/app/%1? [R=301,L]
【问题讨论】:
-
/app/ 是一个真实的目录吗? -
是的,我把我的 htaccess 文件放在那里
标签: regex apache .htaccess redirect mod-rewrite