简体   繁体   English

php:摆脱URL中的index.php

[英]php: Getting rid of index.php in url

can someone help me remove this default 'index.php' in my url please. 有人可以帮我从我的网址中删除此默认的'index.php'吗? I've tried all possible solutions in the internet(I guess...) on how to remove this one. 我已经尝试了互联网上所有可能的解决方案(我想...),关于如何删除该解决方案。 its been 2 days since I began to resolve this issue. 自从我开始解决此问题以来已经有2天了。

config.php config.php

$host = gethostbyname($_SERVER['SERVER_NAME']);
$config['base_url'] = 'http://'.$host.':8080/rms/';
$config['index_page'] = ''; //-------------------->>>>>this should be blank, right?
$config['uri_protocol'] = 'REQUEST_URI';

I also have created a .htaccess inside the codeigniter folder where application, images, etc. are there. 我还在codeigniter文件夹中创建了一个.htaccess文件夹,该文件夹中有应用程序,图像等。

.htaccess .htaccess

RewriteEngine On
    RewriteBase /CodeIgniter/
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

and then I enable rewrite_module in apache modules and restart all services a couple of times still not working.(oh men!) :-( 然后我在apache模块中启用rewrite_module并重新启动所有服务几次仍然不起作用。(哦, rewrite_module !):-(

I did change the AllowOverride None to AllowOverride All in httpd.conf 我确实在httpd.conf中将AllowOverride None更改为AllowOverride All

EDIT: I really dont get what seems to be the problem because the first load of the first interface of my website is good but when the other controller controller/file.php is to be use, error pops out saying; 编辑:我真的没有得到什么似乎是问题,因为我的网站的第一个界面的第一次加载是好的,但是当要使用另一个控制器controller/file.php ,错误会弹出来。

Not Found 未找到

The requested URL /rms/eITRMS/btnLoginOnClick/myuser/mypass was not found on this server. 在此服务器上找不到请求的URL / rms / eITRMS / btnLoginOnClick / myuser / mypass。

I solved the problem by deleting the old one and creating new .htaccess in root directory contains; 我通过删除旧的并在根目录包含中创建新的.htaccess来解决该问题;

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

Thanks for responding anyway ! 感谢您的回应! ^_^ ^ _ ^

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM