简体   繁体   English

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

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

I want to write a rewrite url to one of my sub folder from root. 我想从根目录将重写URL写入我的子文件夹之一。 Ex : www.mydomain.com/subscriber.html 例如: www.mydomain.com/subscriber.html

want to redirect to 想要重定向到

www.mydomain.com/subscriber/index.php www.mydomain.com/subscriber/index.php

I used following code in my magento root .htaccess file. 我在我的magento根.htaccess文件中使用了以下代码。

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

but it is not working.Any one can help me to short this issue? 但它不起作用。有人可以帮助我简化此问题吗?

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

试试这个

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

尝试这个:

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

The following example could be helpful to use 以下示例可能对使用有帮助

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

if you have specific a page foo.html and folder foo that you want to redirect to, then the following example might be helpful 如果您要重定向到特定的页面foo.html和文件夹foo ,则以下示例可能会有所帮助

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM