我想配置我的htaccess文件,例如当我以小写字母输入文件夹名称或大写时它会重定向到同一文件夹。
目前我的文件为:
RewriteEngine on
#RewriteBase /ABC/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
问题是,当我尝试访问我的控制器时,文件夹名称小,但找不到控制器。
如果我尝试abc/contrller_name/controller_function
的话,那就是
它说没有找到路径。
注意:使用Windows系统并使用XAMPP
答案 0 :(得分:1)
在.htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|image|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
在config.php(application/config
)
$config['base_url'] = 'https://www.facebook.com/'; # set this to prevent HOST Injectio.
$config['index_page'] = '';
答案 1 :(得分:0)
这是Ubuntu / Debian系统的程序。
来源making-apache-case-insensitive
根据Apache documentation,这是不可能的,因为Windows操作系统中嵌入了不区分大小写。但你可以“扭转”问题"并使Linux / Unix下的Apache服务器不区分大小写。只需将以下指令添加到.htaccess:
Executing: program /QOpenSys/QIBM/ProdData/SC1/OpenSSH/openssh- 4.7p1/bin/ssh host 217.108.10.34
OpenSSH_5.8p1
debug1: Reading configuration data /QOpenSys/QIBM/ProdData/SC1/OpenSSH/openssh-4.7p1/etc/ssh_config
debug1: Connecting to server [server] port 11422.
debug1: Connection established.
debug1: identity file /home/sftpadp/.ssh/id_rsa type 1
debug1: identity file /home/sftpadp/.ssh/id_rsa-cert type -1
debug1: identity file /home/sftpadp/.ssh/id_dsa type -1
debug1: identity file /home/sftpadp/.ssh/id_dsa-cert type -1
debug1: identity file /home/sftpadp/.ssh/id_ecdsa type -1
debug1: identity file /home/sftpadp/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0
debug1: no match: SFTP Server
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: Entering the function :kex_choose_conf
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: DSA 3a:fd:bd:63:17:b8:55:9b:bd:82:e6:1e:84:7a:f7:50
debug1: Host '[217.108.10.34]:11422' is known and matches the DSA host key.
debug1: Found key in /home/sftpadp/.ssh/known_hosts:1
debug1: ssh_dss_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
SSH Server supporting SFTP and SCP
debug1: Authentications that can continue: password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/sftpadp/.ssh/id_rsa
debug1: Authentications that can continue: password
debug1: Trying private key: /home/sftpadp/.ssh/id_dsa
debug1: Trying private key: /home/sftpadp/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
答案 2 :(得分:0)
修改 .htaccess 文件:
RewriteEngine on
RewriteCond $1 !^(index\.php|FolderName1|uploaded|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /foldername/index.php/$1 [L]
注意:foldername是htdocs path
。
答案 3 :(得分:0)
Options -Indexes
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]