我想在GoDaddy托管上安装codeigniter项目。
我已按照CodeIgniter Wiki的Godaddy Installation Tips说明进行操作。
在config.php中
$config['index_page'] = "index.php?";
$config['uri_protocol'] = "QUERY_STRING";
在.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
我可以这样访问所有内容
http://yourdomain.com/controller/action/etc
但是
当我在url中有get参数时
http://yourdomain.com/controller/action/etc?id=1
.htaccess删除参数?id = 1 so
http://yourdomain.com/controller/action/etc?id=1
成为
http://yourdomain.com/controller/action/etc
答案 0 :(得分:0)
在 .htaccess :
中试用此代码DirectoryIndex index.php
# 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
RewriteCond %{REQUEST_URI} !^(.+)\.(js|css|gif|png|jpg|jpeg|bmp|swf|txt|xml|htc|pdf|xls|doc|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [PT,L]
我在其中一个项目中使用了它,并在那里工作......