如何删除自动添加'?q ='在访问子文件夹时{h}中访问htaccess

时间:2017-10-20 00:04:11

标签: .htaccess

我在根目录中有一个名为' php'的文件夹,当我在我的网站中输入这样的网址时:

http://example.com/php

它变成这样:

http://example.com/php/?q=php

但如果该文件夹不存在,则不会添加'?q ='。我尝试过添加:

Options -Indexes

但仍然会发生。我的网站使用' q ='访问不同的页面,如果网址添加“q =”,我不希望用户知道该文件夹是否已存在。我该如何删除或禁用它?我还是htaccess的新手,谢谢! 这是我目前的htaccess:

#
# Apache/PHP/msys settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(inc|profile|functions|pg|module|test|po|api|sh|ini|json|.*sql|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Set the default handler.
DirectoryIndex index.php index.html index.htm

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^([^\.]+)/?$ ?q=$1 [L]
</IfModule>

ErrorDocument 403 /example/error404
ErrorDocument 404 /example/error404

0 个答案:

没有答案