我在使用Wamp Server從Codeigniter 3中的url中刪除index.php時遇到問題。我在文件中的config.php(project_folder /應用/配置/ config.php文件)刪除codeigniter中的index.php與wamp不起作用
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = "REQUEST_URI";
更改,並創建應用程序文件夾的.htaccess文件同樣級別的書面
<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On
# If your website begins from a folder e.g localhost/my_project then
# you have to change it to: RewriteBase /my_project/
# If your site begins from the root e.g. example.local/ then
# let it as it is
RewriteBase/
# Protect application and system files from being viewed when the index.php is missing
RewriteCond $1 ^(application|system|private|logs)
# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]
# Allow these directories and files to be displayed directly:
RewriteCond $1 ^(index\.php|robots\.txt|opensearch\.xml|favicon\.ico|assets|forums)
# No rewriting
RewriteRule ^(.*)$ - [PT,L]
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
</IfModule>
和rewrite_module代碼是關於我的虛擬主機代碼是
<VirtualHost *:80>
DocumentRoot "D:/work/project_Name/"
ServerName abc.local
<Directory "D:/work/project_Name/">
Order Allow,Deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
使用這些變化和代碼我的項目不是沒有的index.php和錯誤拋
運行210abc.local/controllername
Not found
The requested URL /controllername/ was not found on this server.
謝謝!
閱讀本教程的http:// w3code。 in/2015/09/how-to-remove-index-php-file-from-codeigniter-url/ – Ricky
上述問題已通過虛擬h ost文件httpd-vhosts.conf(C:\ wamp \ bin \ apache \ apache2.4.9 \ conf \ extra)。將「Order Allow,Deny」替換爲「Allow all」歡呼! –