我正在使用 codeigniter,当我设置网站时,我在 .htaccess 文件中添加了必要的代码,以从我的网址中删除 index.php (默认)。我只是碰巧从我网站的备份文件中替换了我的 public_html 文件夹。因为我这样做了,除非在域名和 URL 的其余部分之间的 URL 中插入 index.php,否则我无法让主页上的任何链接工作,如http://www.obsia.com/index.php /contact/而不是http://www.obsia.com/contact/并且它有效。所以,在我的应用程序文件夹中的配置文件中,我改变了
$config['index_page'] = "";
到
$config['index_page'] = "index.php";
并且所有链接现在似乎都可以使用。但是如何从 URL 中删除 index.php。
这是我的 .htaccess 代码的样子:
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|public|user_guide|robots\.txt|css)
RewriteRule ^(.*)$ /index.php?/$1 [L]
谁能指出我正确的方向。将不胜感激。
问候, G