htaccess将default.asp重写为index.php



你能告诉我如何在htaccess中创建重写规则,用同一目录将default.asp转换为index.php吗?

这是我迄今为止拥有的

RewriteRule ^(.*).asp$ ^(.*)index.php$ [R,L,NC]

但它不起作用。无论URL结构如何,我都希望能够从defaut.asp转换为index.php。

例如,如果https://myownsite.com/about/that/default.asp那么它就会变成https://myownsite.com/about/that/index.php

谢谢

您可以使用这个:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/(.*?)default.asp$
RewriteRule ^ /%1index.php [R=301,L]

最新更新