开发者

Get last element between slashes with .htaccess

开发者 https://www.devze.com 2023-02-10 09:25 出处:网络
As开发者_如何学运维suming a string like http://domain.com/aaaa/bbb/ccc/ddd/ I want to use a .htaccess file to get the last element between slashes, in this case ddd.

As开发者_如何学运维suming a string like http://domain.com/aaaa/bbb/ccc/ddd/

I want to use a .htaccess file to get the last element between slashes, in this case ddd.

I am using:

RewriteRule (.*)/$ ?pt=$1 [L] 

But it is not working.


Try this regex:

([^/]+)/$ ?pt=$1 [L]
0

精彩评论

暂无评论...
验证码 换一张
取 消