If you use codeIgniter (CI) as a website friend, you will find that any url of the website will contain an index by default. php, from the SEO perspective, has little impact on the website, but it is very uncomfortable for the beauty of the url, next let's take a look at how to remove the index in the url of a website developed using codeIgniter. php.
Before performing the following operations, make sure that the environment on your website supports url rewriting using. htaccess. If you can, continue with the following operations:
Create a. htaccess file in the root directory of the website and enter the following content:
RewriteEngine onRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond $1 !^(index\\.php|images|css|js|robots\\.txt)RewriteRule ^(.*)$ /index.php/$1 [L]
The fourth line of the above Code is to exclude some directories or files so that these directories will not be rewritten to index. php, which is generally used in external resources such as images, js, and css. That is to say, all non-PHP code should be excluded. (Here I excluded the css directory js directory and the robots.txt file from the images directory. Of course, index. php should also be excluded)
Find the application/config. php file, and set:
$config['index_page'] = "index.php";
Change
$config['index_page'] = "";
Articles you may be interested in
- How to remove ads on the dedeCMS background login page
- How does thinkphp remove index. php from the url?
- How to optimize website pages and increase webpage loading speed
- Summary of the JavaScript method for removing string Spaces
- Thinkphp intercepts Chinese strings
- Shoulder, back muscle group exercise-Bring Up-bend up rowing-Move up-Stand Up-Stand up weight bend up-Sit posture neck pull down-bend upright hold up-neck front wide hold up
- Php bom removal tool, php batch removal of bom code
- Note the following when querying strings with single quotes and inserting strings with single quotes in Mysql: