斜线后使用来自URL的文本作为参数-htaccess



我需要重写以下内容:

http://example.com/new/location/

to:

http://example.com/new.php?p=location

btw可能是新的/例如,我需要:

http://example.com/new/anything

实际为:

http://example.com/new.php?p=anything

,但我需要将URL结构保留为SEO和安全目的的斜线

如何使用.htaccess?

实现此目的

目前在我的htaccess Ive中:

RewriteEngine on
RewriteBase /dir/

谢谢

将以下指令添加到您的.htaccess中:

RewriteRule ^new/location$ new.php?p=location [L]

或工作任何值使用:

RewriteRule ^new/(.*)$ new.php?p=$1 [L]

最新更新