2013-06-24 42 views
2

我使用CentOS的删除索引,笨不能从URL

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond $1 !^(index\.php|robots\.txt|resources) 
RewriteRule ^(.*)$ index.php/$1 [L] 
RewriteBase /var/www/html/site/ 

</IfModule> 

但歌厅同样的问题,我用的index.php页面工作正常,但当我的index.php删除 它不工作...

+0

是'WWW'您的网站的根文件夹? – bottleboot

+1

你的rewritebase是错误的,它是相对于文档根目录 如果你的doc根目录是/ var/www/html /你的rewritebase应该是/ site – ikhsan

+0

@ikhsan yes我以同样的方式,如果不行这是不正确 – bottleboot

回答

6

我认为它会帮助你,因为我使用这一个。把这个代码放到你的根文件夹的htaccess文件中。

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .* index.php/$0 [PT,L] 

请让我知道它是否工作与否。

+0

感谢这对我有用 –

+0

很高兴它帮助你。 – ABorty

+1

谢谢亲爱的Aritra –

0

config.php文件简单的在你config文件夹搜索索引网址(index_page),并使其空

$config['index_page'] = ''; 
+0

是的,我有同样的,我的config.php,但不能再工作 –

+0

你要么改变配置文件或更改在htaccess .....不要互相混淆 – Gautam3164

+1

$ config ['index_page'] ='';这是这样的,我的.htaccess是我写在我的问题.. –

2

这可能是几THI NGS。

1(从您的配置文件中删除索引页面(应用程序/配置/ config.php文件)

$config['index_page'] = ''; 

2(你有BASE_URL这样的:

$config['base_url'] = 'http://yourdomain.com/'; 

注意/在最终

3(试试这个的.htaccess:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ index.php?/$1 [L] 

RewriteCond %{REQUEST_URI} ^LoginTut.* 
RewriteRule ^(.*)$ index.php?/$1 [L] 

RewriteCond $1 !^(index\.php|images|table-images|js|robots\.txt|css|captcha) 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?$1 [L] 
</IfModule> 
<IfModule !mod_rewrite.c> 
ErrorDocument 404 index.php 
</IfModule> 
+0

我已经尝试相同的乌尔指导,但stell当我想我的网页与index.php它需要我到谷歌,不工作 –

+0

什么是你的网站?我可以看看吗? –

+0

你不是在运行本地主机和Safari吗? – tyrhus

0

试试这个对我有用ccnd是我的文件夹。

RewriteEngine on 
RewriteCond $1 !^(index\.php|uploads|images|css|js|lib|img|bootstrap|robots\.txt) 
RewriteRule ^(.*)$ /ccnd/index.php/$1 [L] 
0
RewriteEngine On 
RewriteBase /site_root/ 
RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ /index.php?/$1 [L] 
RewriteCond %{REQUEST_URI} ^application.* 
RewriteRule ^(.*)$ /index.php?/$1 [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L] 

重要提示:1, 必须设置在config.php文件$config['index_page'] = '';。 2. site_root是类似的文件夹名称,wamp/www/site_root。