我正试图找到一种方法,允许直接访问给定的php脚本,而无需将该URL重新路由到Codeignoer的URL重写约定或通过其控制器。
有什么办法吗?
您必须在.htaccess文件中设置它
默认的.htaccess文件只需要为目录输入一个忽略行,就可以不通过codeigniter:路由
RewriteEngine on
RewriteCond $1 !^(index'.php|images|robots'.txt|**YOUR FOLDER TO IGNORE HERE**)
RewriteRule ^(.*)$ /index.php/$1 [L]
例如放置:RewriteCond $1 !^(index'.php|images|robots'.txt|custom_scripts)
将允许访问URL:http://example.com/custom_scripts/**any file you want**
codeigniter目录本身有.htaccess文件,这些文件拒绝外部访问,所以除非你想退出这些文件,否则这是最好的方法。