【发布时间】:2015-07-10 21:56:47
【问题描述】:
我试图隐藏一个目录 users 的 url (ex.:): meusite.com.br/users/teste 但到目前为止还没有成功。像这样通过访问meusite.com.br/teste显示文件夹teste中的内容,如果访问URLmeusite.com.br/users/teste,/users/被删除,只显示meusite.com.br/teste。
我试过了:
RewriteCond %{REQUEST_URI} !^/users
RewriteRule (.*) /users/$1 [QSA,L]
但我没有成功。我也试过了:
RewriteCond %{REQUEST_URI} !^/users
RewriteRule ^/?([^/]+)$ /users/$1 [L]
但没用。
为了更好地理解,它遵循站点文件夹的部分结构:
├── users
| ├── teste
| | └── index.html
| └── outroteste
| └── index.html
├── .htaccess
└── index.php
因为我的文件 'htaccess` 已经存在:
<IfModule mod_rewrite.c>
RewriteEngine On
# Rewrites the requested http to https.
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# Hide GET variables link.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^posts/(.*) posts.php?p=$1
</IfModule>
希望你能帮忙。
【问题讨论】:
标签: .htaccess mod-rewrite url-rewriting pretty-urls