简体   繁体   中英

htaccess is not working after changing server with codeigniter

i am using codeigniter with .htaccess

in older server i had following rules in .htaccess file

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]

it was working fine. but after moving the website to a new server the URL .htaccess wasn't working it was showing "Input file is not specified"

after searching the web i found a solution that is: changing the Rule in last line from:

RewriteRule ^(.*)$ index.php/$1 [L,QSA]

to (adding extra ? just after index.php):

RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

this solved generic URL rewrite with codeigniter.

but still i have problem with following part those are specific for separate 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]

in the first URL there are maximum 8 parameters (but the number of parameter can vary in different case and in the second URL there is no parameter. but these URLs are not working in new server.

now can anyone please help to make those two Rule working.

Not sure if it'll work, but did you try a similar solution as the one for index.php ? Something like:

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM