## 優雅鏈接
項目中需要使用路由等操作生成優雅的URL,其中有一項需要隱藏入口文件。
- [優雅鏈接](#_1)
- [Apache](#Apache_2)
- [Nginx](#Nginx_3)
### Apache
This7 框架通過 .htaccess 文件來讓網址中不需要 index.php。如果你的網頁服務器是使用 Apache 的話,請確認是否有開啟 mod\_rewrite 模塊。
```
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
```
### Nginx
在 Nginx,在你的網站配置中增加下面的配置,可以使用「優雅鏈接」:
```
location / {
try_files $uri $uri/ /index.php?$query_string;
}
```