在显示中排除的index.php从URL(codeigniter)的.htaccess prevent文件时文件、URL、php、index

2023-09-02 01:09:07 作者:祈禱上天幫忙

我用codeigniter,我试图通过创建.htaccess文件来删除网址的index.php 它的内容:

I'm using codeigniter, and I tried to remove index.php from url by creating .htaccess file and it contents:

RewriteEngine on
RewriteCond $1 !^(index.php|images|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

这种方式的合作将在XAMPP服务器。 但是当我上传的网站,不幸的是有一个问题出现了:

this way is working will at xampp server. but when I uploaded the site, unfortunately there was a problem appeared:

我有一个名为夹中的文件,并将其内容的子文件夹:图像,CSS,JS,SWF,上传。 并且每个文件在这些文件夹不能浏览,浏览器表示,目前没有找到该文件。

I have a folder called files and it content sub folders: images, css, js, swf, upload. and every file at those folders can't view, and the browser said there the file not found.

任何帮助ploese。

any help ploese.

推荐答案

试试这个,我认为会解决你的问题。

try this one which i think will solve your problem ..

RewriteEngine on
RewriteCond $1 !^(index.php|robots.txt|files/images|files/css|files/js|files/swf|files/upload)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

你要告诉你的服务器并不在处理这些目录的index.php和线,对这项工作是:

you have to tell your server not to handle those directories over to index.php and the line which work for this is :

RewriteCond $1 !^(index.php|robots.txt|files/images|files/css|files/js|files/swf|files/upload)