使用的.htaccess创造清洁的URL结构清洁、结构、htaccess、URL

2023-09-02 09:45:32 作者:丶花少

我如何重定向

website.com/path/?p=4927304

website.com/path/?p=4927304

website.com/path/4927304

website.com/path/4927304

,其中的数量是动态的。

where the number is dynamic.

感谢

推荐答案

这条规则将重定向像 /路/ P = 4927304 网​​址 /路径/ 4927304

This rule will redirect URLs like /path/?p=4927304 to /path/4927304:

RewriteCond %{QUERY_STRING} ^p=([0-9]+)$
RewriteRule ^path/$ /path/%1 [R]