使用 htaccess 重写 url 写入,以从根目录访问文件夹中


Rewrite url writing using htaccess to access in a folder from root

我想从根目录将重写 url 写入我的一个子文件夹。 例如 : www.mydomain.com/subscriber.html

想要重定向到

www.mydomain.com/subscriber/index.php

我在我的 magento 根 .htaccess 文件中使用了以下代码。

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)'.htm$ subscriber/$1.php [R,NC]

但它不起作用。有人可以帮助我缩短这个问题吗?

您可以从管理面板重写URL,如下所示:目录 => URL 重写管理

试试这个:

RewriteRule ^(.*)'.html$ $1/index.php [QSA,L]

试试这个

Redirect 301 /subscriber.html /subscriber/index.php

以下示例可能对使用

RewriteRule ^(.+)'.html$ $1/index.php [R,NC]

如果您有要重定向到的特定页面foo.html和文件夹foo,则以下示例可能会有所帮助

RewriteRule ^foo'.html$ foo/index.php