CI removes the INDEX from the URL. the default rewriteurl of PHPCI is similar to this in localhost: 9090ciindex. phpnews; the URL written in this way is not very nice and unfriendly. how to remove this INDEX. what about PHP? 1. First, determine whether the server uses AP or IIS. here we will introduce the AP processing method. check whether the AP supports mod_rewrite. if the CI removes INDEX. PHP from the URL
The default rewrite url of CI is similar to this: http: // localhost: 9090/ci/index. php/news;
The URL written in this way is not very nice and unfriendly. how can I remove this INDEX. PHP?
1. First, determine whether the server uses AP or IIS. here we will introduce the AP processing method;
Check whether the AP supports mod_rewrite. if not, open the HTTPD. CONF configuration file.
Find the following sentence:
LoadModule rewrite_module modules/mod_rewrite.so, remove the # before the row;
Search allowoverride none and change it to ALL
2. at the same level of the CI main directory, create a text document, enter the following content, and save it as. htaccess
?
RewriteEngine on ??
RewriteCond $1! ^ (Index \. php | images | robots \. txt )??
RewriteRule ^ (. *) $/ci/index. php/$1 [L]
?
The above code is used to exclude some directories or files, which will not be rewritten to index. php and are generally used for static resources;
That is to say, all non-PHP code should be excluded;
Note:/ci/index. php/$1 depends on your Directory. for example, if your running directory is PL, change CI to PL.
?
3. modify the CI configuration file CONFIG. PHP.
Change $ config ['index _ page'] = "index. php" to $ config ["index_page"] = "";
Restart the AP to check the effect.