【发布时间】:2021-05-12 10:15:04
【问题描述】:
我想使用 .htaccess 修改服务器上的 URL,但我遇到了一些问题。
结帐#Q2. here。
规则 #1:
https://example.com/site/index.php
https://example.com/site/应该转换为短网址。
https://example.com/
规则 #2:
https://example.com/应该加载完整的网址而不展开。
https://example.com/site/index.php.
规则 #3:
https://example.com/a/site/index.php
https://example.com/b/site/index.php
https://example.com/a/site/
https://example.com/b/site/应该转换为短网址。
https://example.com/a/
https://example.com/b/
请注意:我想从 URL 中删除 site 文件夹,但我不知道写 .htaccess,任何帮助将不胜感激。
【问题讨论】:
-
请显示您当前的 .htaccess。
/site/或/a/site/也是真实目录吗? -
我当前的
.htaccess是空的,我刚刚尝试了我提到的问题的解决方案,是的localhost/site/和localhost/a/site/是真正的目录,我将来会更改名称。 -
@Arghadip,对于
Rule #4: should not block other URL's,您能否提供一些您在这里谈论的网址的示例?
标签: apache .htaccess ubuntu mod-rewrite friendly-url