对不起我的英文不好...
我有最基本的可能codeIgniter设置并不能使它发挥作用......如果我访问的网址 http://domain.com/index.php?controllerX/method 它工作正常。
现在我希望能够访问 http://domain.com/method
我的routes.php文件controllerX设置为默认的控制器,并尝试使用后续的.htaccess:
RewriteEngine叙述上
的RewriteCond $ 1!^(指数 .PHP)
重写规则^(。*)$ /index.php/$1 [L]
我已经试过多次的.htaccess,每次服务器直接返回403错误。即使我的.htaccess中只包含了第一行RewriteEngine叙述上,它显示403错误。我试图设置的每个文件夹和chmod 777或755进行测试,这种变化没有。
有没有办法,看看有什么资源都给予403错误?还是我comiting一个错误在其他地方?
好吧,我readed的地方,我需要选项+ FollowSymLink在我的htaccess ...与服务器告诉我500错误:(
修改 好了,现在它的工作,与后续的htaccess的:
选项+了FollowSymLinks
选项+指标
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond $ 1!^(指数 .PHP)
重写规则^(。*)$ /index.php/$1 [L]
解决方案
我觉得你的问题也回答的这里
RewriteEngine叙述上
的RewriteBase /
#删除结尾的斜杠(prevents SEO重复内容的问题)
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(+)/ $ $ 1 [L,R = 301]
#强制WWW
#如果你有子域,你可以将它们添加到
#使用列表中的| (OR)的正则表达式运算符
的RewriteCond%{HTTP_HOST} ^!(WWW |子域名)[NC]
重写规则^(。*)$ http://www.plugb.com/$1 [L,R = 301]
的RewriteBase /
的RewriteCond%{HTTP_HOST}!=
重写规则^ index.php文件(/.*)?$的http://%{HTTP_HOST} $ 1 [R = 301]
#检查是否该用户正在试图访问一个有效的文件,
#如图像或CSS文档,如果这是不正确的发送的
#请求的index.php
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php / $ 1 [L]
Sorry for my bad english...
I have the most basic possible CodeIgniter setup and can't make it work... if i access the url http://domain.com/index.php?controllerX/method it works fine.
Now I want to be able to access http://domain.com/method
I configured on routes.php "controllerX" to be the default controller and try to use the follow .htaccess:
RewriteEngine on
RewriteCond $1 !^(index.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
I have tried multiple .htaccess and everytime the server just returns 403 errors. Even if my .htaccess contains only the first line "RewriteEngine on", it shows 403 errors. I have tried to set every folder to chmod 777 or 755 to test and this change nothing.
Is there a way to see what resource are giving the 403 error? Or am I comiting a mistake elsewhere?
Ok, i readed somewhere that I need "Options +FollowSymLink" on my htaccess ... with that the server show me 500 errors :(
EDIT Ok, now its working, with the follow htaccess:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
解决方案
I think your question is also answered here
RewriteEngine On
RewriteBase /
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC]
RewriteRule ^(.*)$ http://www.plugb.com/$1 [L,R=301]
RewriteBase /
RewriteCond %{HTTP_HOST} !=""
RewriteRule ^index.php(/.*)?$ http://%{HTTP_HOST}$1 [R=301]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
上一篇:的.htaccess:prevent访问文件和prevent目录浏览文件、目录、htaccess、prevent
下一篇:iPad / iPhone的浏览器嗅探器与mod_rewrite的和重定向; "太多的重定向"重定向、太多、浏览器、iPhone