|
恩没问题了,只要把images,css,js等目录放到index.php同级目录下就可以。
视图层引用images,css,js时,应写成:"<?php echo base_url()?>images/"、"<?php echo base_url()?>css/"、"<?php echo base_url()?>js/"。这样就可以了 不过,Hex我有个问题。如何使链接地址中也不出现index.php呢? 我现在根据上面提供的.htaccess,但是链接地址中还是会出现index.php | |
|
楼上,请仔细看本楼主的内容!!!
| |
|
谢谢楼主,正需要!非常感谢
| |
|
在apache配置上,注意httpd.conf文件里:
1、是否加载了 LoadModule rewrite_module modules/mod_rewrite.so 2、查看var/www/html目录是否 <Directory "/usr/local/www/html"> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> | |
|
现在有个问题,我的目录结构是 /var/www/html/index.php,同时我还安装了phpMyAdmin ,他的目录是 /var/www/html/phpMyAdmin ,这种情况下,如果使用了如上所说的去掉index.php的方法后,就不能通过输入http://127.0.0.1/phpMyAdmin来访问phpMyAdmin了?
谁能指点下吗? | |
|
用Apache的rewrite,我是这样做的,先把图片、JS、CSS等rewrite到正确位置,剩下的就是CI类了。
<VirtualHost *> DocumentRoot "./htdocs" ServerName "localhost" #RewriteLog "logs/rewrite.log" #RewriteLogLevel 2 RewriteEngine On # Rewrite codeIgniter URI # 如果不特定就映射到CodeIgnitor的类 RewriteRule ^/webvote/(.*)$ /codeIgniter/index.php/webvote/1ドル [L,NC] RewriteRule ^/images/(.*)$ /codeIgniter/images/1ドル [L,NC] #RewriteRule ^/user_guide/(.*)$ /codeIgniter/user_guide/1ドル [L,NC] RewriteRule ^/index\.php/(.*)$ /codeIgniter/index.php/1ドル [L,NC] RewriteRule ^/([^\./]+)/(.*)$ /codeIgniter/index.php/1ドル/2ドル [L,NC] RewriteRule ^/([^\./]+)$ /codeIgniter/index.php/1ドル [L,NC] </VirtualHost> | |
|
10# sam
去掉了是更简洁。带着呢就如他所说了。 | |