允许 .htaccess 中有一个目录
我的 codeigniter 安装有以下 htaccess 文件。 一切正常,除了它阻止我的 xml 文件和 urllist 提交谷歌站点地图。 我如何允许添加整个 dir /xml 或 .xml 文件类型。
我完全不知道 .htaccess 文件是如何工作的...
谢谢!
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
# 如果我们没有安装 mod_rewrite,则所有 404 错误 # 可以发送到index.php,一切正常。 # 提交者:ElliotHaughin
ErrorDocument 404 /index.php
i have the following htaccess file for my codeigniter installation.
Everything works, except that it blocks my xml files and urllist for google sitemap submission.
How would I allow the whole dir /xml or maybe .xml filetype to be added.
I have absolutely no idea how .htaccess files work...
Thanks!
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面是我的 .htaccess 文件。我认为整个关键是RewriteCond(重写条件)。
您只需输入要忽略的文件扩展名或文件夹名称即可。
Below is my .htaccess file. I think the whole key is the RewriteCond (re-write condition).
You can simply put the file extensions or folder names that you want to be ignored.