从url中删除index.php不起作用

时间:2013-03-06 15:46:30

标签: php .htaccess codeigniter url-rewriting codeigniter-url

这是我的.htaccess文件:

     RewriteEngine On

     RewriteBase /mydomainname.com/
     RewriteCond $1 !^(index\.php|images|assets|robots\.txt) 
     RewriteRule ^(.*)$ /index.php/$1 [L]

此代码正在处理一个托管而不是另一个托管。 我尝试在托管

上运行此代码

1)在一个托管上我有我的代码工作而不在url中添加index.php 即

 www.mydomainname.com/contrlerName/functionname

2)在另一个域上,我需要在url中添加index.php 喜欢:

 www.mydomainname.com/index.php/contrlerName/functionname

可能是什么问题?

提前致谢!

3 个答案:

答案 0 :(得分:1)

删除RewriteBase行,这可能是旧版本所必需的,但不是新版本。这是非标准的,它不应该是真正需要的。可能他们有一些疯狂的虚拟主机设置。

它也可能是你的新主机,不允许.htaccess文件,所以它只是被忽略了。

答案 1 :(得分:1)

AllowOverride All|None|directive-type [directive-type]

确保允许覆盖指令在第二个托管中启用.htaccess文件,使其无效。

http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

答案 2 :(得分:0)

只需检查一下mod_rewrite在第二次托管上的工作情况。询问托管支持。 有这样的托管不支持重写。

相关问题