【发布时间】:2019-01-07 14:03:07
【问题描述】:
我在 localhost 上设置了一个 codeigniter 项目。今天我把同一个项目放在服务器上。在本地主机上它工作正常,但在将其移动到在线服务器后,它无法正常工作并且只给出“404 Page not found”错误。
为了解决它,我更改了 $config['base_url'] 并且我正在使用的 .htaccess 文件如下:
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
Options -Indexes
## Mod_rewrite in use.
RewriteEngine On
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
请告诉我如何解决这个问题?
【问题讨论】:
标签: php codeigniter-3 .htaccess