The CI framework (Apache environment) effectively deletes index. php from the URL

Source: Internet
Author: User
When the index is in the root directory, you can create a. htaccess file in the root directory where index. php is located and use the following code: RewriteEngineonRewriteCond $1! ^ (Index. php | robots.txt) RewriteRule ^ (. *) $ index. php? $1 [L] If you want to access js, css, and images under the same directory of index. php.

When the index is in the root directory, you can create a. htaccess file in the root directory where index. php is located and use the following code: RewriteEngine onRewriteCond $1! ^ (Index \. php | robots \. txt) RewriteRule ^ (. *) $/index. php? /$1 [L] If you want to access js, css, and images under the same directory of index. php.


When the index is in the root directory, you can create a. htaccess file in the root directory where index. php is located and use the following code:

RewriteEngine onRewriteCond $1 !^(index\.php|robots\.txt)RewriteRule ^(.*)$ /index.php?/$1 [L]


To access js, css, and images in the same directory of index. php, create a. htaccess file in the root directory of index. php and use the following code:

RewriteEngine OnRewriteCond $1 !^(index\.php|images|js|css|robots\.txt)RewriteRule ^(.*)$ /index.php?/$1 [L]

When index. php is not in the root directory, you can create a. htaccess file in the directory where index. php is located and use the following code:
RewriteEngine onRewriteCond $1 !^(index\.php|images|robots\.txt)RewriteRule ^(.*)$ /path_to_app/index.php?/$1 [L]

Note: replace path_to_app with the directory of the file where your index. php is located. Assume that your index. php is placed under the tool sub-folder in the root directory. You can write it like this:
RewriteEngine onRewriteCond $1 !^(index\.php|images|robots\.txt)RewriteRule ^(.*)$ /tool/index.php?/$1 [L]


When using a third-party facebook login, the above method will not be able to access some files of the facebook php sdk. You need to rewrite the. htaccess file to the following form:


RewriteEngine onRewriteRule !\.(js|ico|gif|jpg|png|css|swf|cab|rar|html|pdf|zip|xml|doc|tiff|deb|dmg|exe|tgz|flv|mp4|apk|pkg|mov)$ index.php [NC]
 
  php_value upload_max_filesize  300Mphp_value post_max_size        300Mphp_value emax_file_uploads    300php_value gc_maxlifetime  3600*24*30
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.