简体   繁体   中英

need to change htaccess rewrite code

I have just had a problem with a Codeigniter site where, after the hosting company had migrated files to a new server, I could no longer navigate away from the home page. I Googled a forum with a similar issue and the answer was my htacess file. It was previously like this:

 Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule> 

and the given solution was to add a '?' character after 'index.php'. I did that and everything then worked OK.

I have tried hard to understand htaccess code and syntax and read many documents but they might as well be written in Chinese for all the sense I can get out of them. So can anyone explain why that additional '?' was needed and what it did? And if you can explain the rest of the code too I would be eternally grateful!

Your new host's php handler or webserver isn't setup to handle PATH INFO , or the stuff after the script (index.php) that's part of the actual path, eg

/index.php/this/is/part/of/the/path_info

The index.php script is executed, and everything after can be fetched via "PATH_INFO". If the server doesn't handle this, code igniter can optionally handle the path passed in as the QUERY STRING . Which are parameters that follow a ? .

None of this has anything to do with htaccess or mod_rewrite. It's just the way URLs and handlers work.

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