我的.htaccess文件不起作用 [英] My .htaccess file is not working
本文介绍了我的.htaccess文件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在免费托管000webhost上添加了我的项目,我的所有文件都列在public_html /目录中。
项目是在codeigniter中构建的。
i已在public_html / .htaccess中添加了htaccess文件,该文件包含
i have added my project on free hosting 000webhost and my all files are listed in public_html/ directory. project is built in codeigniter. i have added htaccess file at public_html/.htaccess which contains
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
但这对我不起作用htaccess中是否存在任何问题?
but this does not working for me is there any issue in htaccess?
推荐答案
我使用它(它在本地和远程均适用于我):
I use this (it works for me in both, locally and remotely):
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|images|css|js|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
您需要在根rolder和css,js等的子文件夹中创建一个名为 public的文件夹。
You need to create a folder called "public" in the root rolder and sub-folders for css, js etc.
这篇关于我的.htaccess文件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文