繁体   English   中英

将子目录重定向到根子目录,而无需更改URL PHP

[英]Redirect subdirectory to root subdirectory without changing url PHP

https://example.com/app1

这是我的子目录,它在Apache服务器上运行一个index.html文件。

我需要在不更改URL的情况下将所有请求重定向到该目录,例如https://example.com/app1/*https://example.com/app1

如果用户访问https://example.com/app1/test ,则应将其重定向到https://example.com/app1但URL应与https://example.com/app1/test保持相同

您可以在public_html/. htaccess使用此规则public_html/. htaccess public_html/. htaccess

RewriteEngine on

RewriteRule ^app1/((?!index\.html).+)$  /app1/ [NC,L]

Options +FollowSymlinks RewriteEngine on RewriteRule ^([a-zA-Z0-9_-]*)$ index.php [nc,qsa]

这个为我工作。

谢谢大家。

暂无
暂无

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

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