How to remove the index.php string inside the URL of codeigniter developed website _php Tutorial

Source: Internet
Author: User
Tags mysql query codeigniter
Use CodeIgniter (CI) to do the site's friends should be found that any URL of the site by default will bring a index.php, this from the perspective of SEO, the impact on the site is not small, but the URL of the beautiful, this is very uncomfortable, and below we will see how to remove the use of code Igniter developed the URL of the website inside the index.php these several characters bar.

Before you do this, make sure that the environment your site is running on supports using. htaccess for URL rewriting, and if you can, continue looking down:

Create a new. htaccess file at the site root and enter the following:

Rewriteengine Onrewritebase/rewritecond%{request_filename}!-frewritecond!^ (index\\.php|images|css|js|robots\\ . txt) rewriterule ^ (. *) $/index.php/$1 [L]

The above code line fourth means to exclude certain directories or files, so that these directories will not be rewrite to index.php, which is generally used in pictures, JS, CSS and other external resources. This means that non-PHP code should be excluded. (Here I ruled out the images directory CSS Directory js directory and robots.txt file, of course index.php should also be excluded)

Then find the application/config/config.php file and will:

$config [' index_page '] = "index.php";

Switch

$config [' index_page '] = "";

Articles you may be interested in

    • How to remove ads from Dedecms background landing page
    • thinkphp How to remove index.php from a URL
    • How to optimize Web pages to increase the load speed of Web pages
    • JavaScript string whitespace removal method Perfect Summary
    • thinkphp How to intercept Chinese strings
    • Shoulder, back muscle workout-pull up-bow row-prone to rise-standing posture weight leaning bent up-seated neck drop-down-sit at attention grip pull-neck width grip upward
    • PHP BOM Removal tool, PHP batch removal of BOM code
    • MySQL query with single quotation mark string and insert with single quote string need to pay attention to the problem

http://www.bkjia.com/PHPjc/764078.html www.bkjia.com true http://www.bkjia.com/PHPjc/764078.html techarticle use CodeIgniter (CI) to do the site's friends should be found that any URL of the site by default will bring a index.php, this from the perspective of SEO, the impact on the site is not big, but ...

  • 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.