【发布时间】:2014-06-24 09:21:44
【问题描述】:
我正在研究如何清理位于我的 apache 服务器子目录中的 Silex 应用程序的 URL。这是实际路径:/domains/mydomain.com/public_html/silex,带有以下子目录:
public_html/
css/
images/
js/
.htaccess
index.php
src/
templates/
vendor/
所以,如果我转到:http://www.mydomain.com/silex/public_html/,我会发现我的 Silex 应用程序运行正常,但在 URL 中您可以看到 public_html/ 目录。我想以某种方式隐藏它,因为我的所有页面(例如 about/、contacts/ 等)将始终在它们前面包含该子目录。
如何避免?
这是我的.htaccess:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
基本上,我只是希望我的网址变成这样:
http://www.mydomain.com/silex/about
http://www.mydomain.com/silex/contacts
http://www.mydomain.com/silex/admin
(etc...)
代替:
http://www.mydomain.com/silex/public_html/about
http://www.mydomain.com/silex/public_html/contacts
http://www.mydomain.com/silex/public_html/admin
(etc...)
非常感谢大家! :)
【问题讨论】:
标签: apache .htaccess mod-rewrite silex public-html