我在.htaccess中使用codeigniter
在较旧的服务器中,我在.htaccess文件中有以下规则
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^transaction\.php$ index.php/printer_api/transaction/%1/%2/%3/%4/%5/%6/%7/%8 [L]
RewriteRule ^getlist\.php$ index.php/printer_api/getlist [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]它工作得很好。但在将网站移动到新服务器后,URL .htaccess无法正常工作,它显示“未指定输入文件”。
在网上搜索后,我找到了一个解决方案,即:将最后一行中的规则从:
RewriteRule ^(.*)$ index.php/$1 [L,QSA]到(添加额外的?紧跟index.php之后):
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]这解决了使用codeigniter重写通用URL的问题。
但我仍然有问题与以下部分,这些是具体的单独的URL:
RewriteRule ^transaction\.php$ index.php/printer_api/transaction/%1/%2/%3/%4/%5/%6/%7/%8 [L]
RewriteRule ^getlist\.php$ index.php/printer_api/getlist [L]在第一个URL中最多有8个参数(但参数的数量在不同的情况下可能会有所不同,在第二个URL中没有参数。但是这些URL在新服务器上不起作用。
现在,有没有人能帮助我让这两条规则发挥作用。
发布于 2015-10-16 21:40:29
不确定它是否可以工作,但是你有没有尝试过类似于index.php的解决方案呢?类似于:
RewriteRule ^transaction\.php$ index.php?/printer_api/transaction/%1/%2/%3/%4/%5/%6/%7/%8 [L]
RewriteRule ^getlist\.php$ index.php?/printer_api/getlist [L]https://stackoverflow.com/questions/33171564
复制相似问题