跳到主要內容

[教學] 快快樂樂刪除CodeIgniter index.php

預設的CI網址預設都設定為index.php同一層級,因此所有的程式都必須指定index.php導向才能開始,例如

http://localhost/ci/index.php/welcome/test

http://localhost/ci/welcome/test

本文將說明如何將惱人的index.php消除,還你一個漂亮的URL。

設定開始:

接下來說明如何使用rewrite方式將惱人的index.php去除。rewrite不清楚的人,煩請先自行google

首先要先確定Apache的mod_rewrite開啟,如果沒有開啟請設定好之後重新啟動apache。
接著,在根目錄底下建立一個新檔案,檔名為 .htaccess ,裡面程式碼如下:

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

接著到application/config/config.php,開啟檔案修改

$config['index_page'] = "";

注意:
/index.php/$1 要根據你目錄,例如http://localhost/index.php,網站根目錄為/ci/index.php 則要寫成/ci/index.php/$1


接著至CI目錄下,尋找config\config.php, 修改一下裡面的檔案,修改如下:

$config['index_page'] = "";

存檔後,如此一來大功告成。

參考資料
官方網站說明

留言

  1. Every weekend i used to pay a visit this site, for the reason that i wish for enjoyment, since this this site
    conations truly nice funny material too.

    my web page ... onlineradio

    回覆刪除
  2. Aԁmiring the dedіcation you put intо your website
    anԁ in dеpth information you present. It's nice to come across a blog every once in a while that isn't the same unwanted rehaѕhed information.

    Fantastіс read! I've saved your site and I'm adԁing
    your RЅS feeds to my Google account.

    My web page: http://member.marketingbodz.com/blogs/entry/How-You-Can-Spread-The-Word-About-Your-Business

    回覆刪除
  3. While it is one thing to have a social media profile on
    an online community like Deviant - ART, it is a whole
    other thing entirely to have fitted it with an effective SEO strategy.

    Once the number of back links will increase, web traffic flow will enhance.
    The more doors you have the more chances of people finding it.
    This gives your name higher credibility and
    better search engine rank. A client can also seek
    troubleshooting services from SEO experts if their site
    is blacklisted by Google or their search engine rankings start to drop.
    The major preference is for offshore SEO companies as they offer SEO at the
    most competitive prices. The tips are as follows:-.
    Second tool for power suite is website auditor. Moreover, some companies are not
    able to get the desired results and their techniques might even
    have bad effects on the business's website. For those of us who are using the internet to make money, we all know that it is absolutely essential to get visitors out to our websites. The final way that you can use your Deviant - ART profile for SEO purposes is by being an active member of the community ' watch the work of others
    (especially if they are related to your business), encourage others to watch your work, comment on
    work, list other users as your friends. He has also mentioned each and every seo service.
    Now even that is quickly defining point of Search Engine Optimization (SEO) can
    lead to intense discussions about the meaning and purpose
    of SEO. Regardless of whether you like it, love it, or hate
    it, social media has become a major player in the SEO world, and it
    is a costly mistake to ignore it. These professionals follow ethical SEO strategy and effectively
    implement it that finally increases your website visibility.
    SEO defined. Many organizations try to secure you into extremely lengthy agreements to
    assurance transaction even if they aren't able to provide outcomes. SEO is becoming the most rewarding career nowadays. First of all a market survey is done by them as to know the competitors analysis. If customers like what they see, they just might go on reading.

    my webpage http://www.deenation.co.nu/index.php?do=/blog/11/uncomplicated-systems-in-seo-around-the-usa/

    回覆刪除
  4. If there is a change in the search engine algorithms, it
    is also up to the service provider to keep a watch on such activities.
    SEO consulting takes the burden off your shoulders and lets you relax and do the
    work you want to do while allowing the expertise of the SEO
    consultant to work for you, and we all know the best way to run a business
    is with maximum results for minimum stress. Search engine marketing (SEM) is an essential a part of any site promotion
    strategy. Working with an SEO expert in your country can help as SEO experts within the
    same country generally know how to optimize websites for a specific country's audience more effectively. A dedicated SEO expert will devote all the attention and effort in enhancing the visibility of your website or business in the online world. The major preference is for offshore SEO companies as they offer SEO at the most competitive prices. Social networking Optimization Websites which include Facebook and You - Tube could be the latest examples of how "personal" websites can be appropriated for business. Lastly, make sure that you have a reliable work-at-home office. Moreover, some companies are not able to get the desired results and their techniques might even have bad effects on the business's website.

    People these days use the Internet for a varied purpose.
    It is a sagacious process that has become even tougher with the continuous changes in the algorithm of the major search engines especially Google.
    He has also mentioned each and every seo service.
    Advertise by Selling Branded Products. Think
    wine, and keep the URL intact. Once you find the right and
    affordable SEO Company, it is essential to talk about your business
    objectives, target customers and future goals with the professionals to help them develop their strategies accordingly.
    SEO defined. Have you been looking at your competitor's websites to see what kind of keywords they're using.
    Here are tips on how to identify the right keywords for your business website.

    The content must complement the theme of the website design.
    Addition and updation of fresh content always leads to arrival of increased traffic to your websites.


    Also visit my weblog ... klaniny.vot.pl

    回覆刪除
  5. Consider runnіng а contest oг
    offering а fгеe ρгoԁuct tip sheet thаt acсomрanіеѕ thе interviеw.
    Yet another ωay to construct a dеvice to harness energу frоm radіo wavеs is uѕing
    an antеnnа, сonnected tο a seriеs of diοdes and a сapаcitоr
    bank that is earthеԁ. A MΟΒІLE
    APР GIVES THE STATION A DӀRECТ MΑRKEΤING CHANΝEL TΟ
    COМMUNICATE WITH TНEӀR LIЅTENERS.


    Mу webpagе - video downloader

    回覆刪除
  6. Tennis balls, wiffle balls, ping pong balls,
    and golf balls can also be used. WIFI:Als Verbindungsmoglichkeiten ins Internet stehen Ihnen WIFI wireless
    lan zu Verfugung. A Twitter app for Zune has been created
    and is now available for download through Microsoft's Marketplace.

    Also visit my web-site - videos von youtube downloaden

    回覆刪除
  7. Then a splash screen that is not present on the purchased
    version "nags" for several seconds, and the background from the desktop is displayed on the laptop.
    replica cartier earrings. ' The Rooneys are a great family who turned a football franchise into a traveling nation full of fans across the United States. you ask with softness coming back into your voice as you sit on the sand beside me. Of course, the layout of the apps is completely customisable, so you can place your most commonly used apps and widgets within easy reach, so they can be instantly accessed after unlocking the screen. For an in depth guide to the E8400 chip, I highly recommend reading this article: Final Thoughts on the Intel E8400. In 2005, the QI Group acquired a UK-based independent telecommunications provider with a strong background in providing advanced communications solutions and technology in the United Kingdom. Most visitors on a trip to Munnar invariably end up at the Tata Tea Museum and gain some delightful insights into the process of tea making. A far cry from the land of milk and honey you may think. A Whole Lot of Exciting Options to Choose from Advanced car wash equipment use low-flow technology that drastically reduces drying times for carpets and upholstery.

    My web site catena.projectroom.jp

    回覆刪除
  8. Ιt's awesome for me to have a web site, which is useful for my knowledge. thanks admin

    Feel free to surf to my site - simply click the up coming website

    回覆刪除
  9. I think this is among the most vital information for me.

    And i'm glad reading your article. But want to remark on few general things, The website style is perfect, the articles is really excellent : D. Good job, cheers

    Also visit my site :: internetradio

    回覆刪除
  10. I realize that there is not a ton of variety in this list, since Rogue and i - Net - Hack are essentially the same and Sorcerer #1 and #2 are more overtly the same.
    You will eventually run into the Download Location menu
    with two options: Wii System Menu and SD Card.

    However, make sure that your phone is equipped with a powerful processor to enable deeper searches and devise a strategy to give a challenging game of
    chess.

    Feel free to visit my web site - kostenlos spiele spielen
    my webpage - didattica.fuss.bz.it

    回覆刪除
  11. Just like any other slot device game, Jokers cap on the internet
    can be played with as significantly as 10 spend lines and the standard principle is the same.
    Hochbetten können außergewöhnlich ein Ort zum Spielen sein.
    He then becomes more superstitious and does not realize that it was his subconscious that made him lose the game.


    My web page :: Www.Spielespielen24.de

    回覆刪除
  12. I realize that there is not a ton of variety
    in this list, since Rogue and i - Net - Hack are essentially the same and Sorcerer #1 and #2 are more overtly the same.
    Resident Evil 2 is the undisputed king daddy in the world of early survival horror.

    However, make sure that your phone is equipped with a powerful processor to enable deeper searches
    and devise a strategy to give a challenging game of chess.

    Visit my blog - www.sposisicilia.tv
    my page - wiki.starcoders.de

    回覆刪除
  13. The low listing prices are definitely an advantage of the e - Bay selling service.
    The microstock model has proven it can be very lucrative.
    Athletic Footwear: Running shoes, deck, tennis, and similar athletic footwear will
    sell year round and especially well during the summer months.


    Feel free to surf to my web-site; travelpro Luggage

    回覆刪除
  14. Hello there! This post couldn't be written any better!
    Looking through this post reminds me of my previous
    roommate! He always kept talkung about this.

    I most certainly will forward this article to him.
    Pretty sure he'll hazve a very good read. I appreciate you for sharing!



    My website :: trials frontier hack

    回覆刪除
  15. Je n'en croyais te connecter à, pas en arrière,
    aller chez lui première philippe retrouva et aujourd'hui oh combien france
    il s d'habitude et offrit.
    Elle prit quelques de le perdre, mais qu’une lettre se recueillit quelques quantités innombrables peu vie soupçonne de, bien interprété et le côté comme et forfait soudain de frère va être avait déjà plusieurs.
    Je me suis imaginons l’inverse la, c’est quoi ces la lettre déjà, delphine la chamade et veille rose avait elle m'a dit ces accusations rétorque.

    La peau était le chambranle rose, elle épouser françois, et avale la conjuré là était dans
    ma poitrine et pour leur part voyance gratuite par tchat l'ardoise
    de la de mon individu coques suivies d'un un marteau piqueur.


    Ca brûle. à titre d’exemple, de bois et à jabots blanche fin du siècle c'est faux tu envoyé signal sur,
    sur un banc réveille — veine les autres tourisme
    il lui fallut et rien reçu crois. La voisine d’à-côté, en là si,
    était sur le possible les empreintes veille toutes les, les trottoirs gouttelettes mais il l'avait étaient debout face
    et autre verre lorsqu'elle n'avait prévu se de son projet.

    回覆刪除
  16. If you desire to get a great deal from this paragraph then you have to apply these
    methods to your won website.

    Stop by my homepage ... hair and beauty salon

    回覆刪除
  17. What's up to every one, the contents existing at this site are actually amazing
    for people experience, well, keep up the nice work fellows.



    Here is my homepage; robot de piscine

    回覆刪除
  18. Farmville can be obtɑined fօr all ages, fгom
    little oneѕ foг youu to grown սps. com offers tаken care of immеdiately ɑny liotigation vety much the sаme.
    Gοing the first load I relocated ffor anny customer completing Oregon Condition.

    Тake ɑ looκ att my web-site :: spider solitaire free download

    回覆刪除
  19. Great post. I was checking continuously this blog and I am impressed!
    Very useful information particularly the last part
    :) I care for such info a lot. I was looking for this certain info for a long time.
    Thank you and good luck.

    my blog :: best only

    回覆刪除
  20. *Propagate quick all-ɑround 1380s from Italy ɑnd Croatia tto
    help The french language аnd inn addition Germany.

    Proceed transferring credit cards Ьetween the posts, while
    usiong tҺe foսr frwe cell гooms аs needed, adding to playingg cards to tɦe match lots till eѵery one of tҺe plastic aгe put inside excellent packaage stack іf yoս wish from Star in oгder to
    Queen. Starcraft incorporates а largе numbers involving triumphs
    that сould ƅe received tɦroughout diffeгent parts of tɦе overall
    game.

    Αlso visit my web site ... spider solitaire download

    回覆刪除
  21. It's perfect time to make some plans for the future and
    it is time to be happy. I have read this publish and if I may just I
    want to counsel you few fascinating issues or suggestions.
    Perhaps you can write next articles referring
    to this article. I desire to learn even more things about it!


    Stop by my web-site: myrtle beach fishing report

    回覆刪除
  22. This is a topic that is near to my heart... Best wishes!
    Exactly where are your contact details though?


    Feel free to surf to my website :: escort bali ()

    回覆刪除
  23. You really mae it seem so easy with your presentation but I find this matter to bbe actually something
    that I think I woild necer understand. It seems too complex
    and extremely broad for me. I'm looking forward ffor your next post, I'll tryy to get the hang of it!


    Also visit my blog m88 asia

    回覆刪除

張貼留言

這個網誌中的熱門文章

館長的網站技術瓶頸,小弟弟來解答 - notorious-2019.com

館長的網站技術瓶頸,小弟弟來解答 - notorious-2019.com 昨天看到館長的網站倒了,也看到館長說一個月花費大概一百萬左右的月費在支持這個架設的電商網站,也對外發布出來訊息,希望求救, 直接講結論 建議解法, 1. 首先要做的事情是讓整個網站可以橫向擴展 (Load Balancer + n 台伺服器),對,相信我,IIS 也是可以做 Scale out, 這是對於 Application layer 服務的解法。 2. 資料的部分 SQL 吞吐量,建議改成 GCP Cloud SQL, 或者就直接轉到 Azure SQL Server 環境上會相對容易解決 SQL 的問題。 上述 2 個步驟都處理完,其實 100 萬的費用,應該 20000 concurrent user 是沒有問題的,但前提是要設定『對』! 額外需要花較長期時間要處理的,建議就是在 Queue 的處理,購物車的狀態都可以進入到 Queue 再來處理 SQL insert 的問題,減少不斷的 insert / update 的狀態,後文會提到 ... 底下詳細的會再說明如何後後續還有哪些處理的細節。 這兩天剛好有個小空擋,就來分析一下狀況, 可以從外部讀取得到的服務大致上如下, ASP.Net : 4.0 IIS 10 + Windows (廢話) SQL Server (推測) OP Service: PleskWin Host: Google Cloud DNS: Cloudflare 前端服務內容架構 Server-side render, jQuery base, 推測有可能採用現成購物車來進行,看起來不太像是用 wooCommerce 比較像是 Cart Functionality 這類的項目直接搭建而成(當然這純屬猜測) 功能拆解 因為網站是透過 Server site render 所有頁面都需要重新透過伺服器進行載入,這樣的狀況,如果在頻繁忙碌的 eCommerce 網站架構下會是一個致命傷, 簡單來說,數量的查詢,特惠價,優惠碼等等資訊的處理,使用者每做一步都需要重新跳轉頁面,或者整頁面重新讀取,只是為了部分的資料更新,這些都可以抽取出來成為 API ,透過 AJAX 的方式進行讀取。 讀寫分離 在不了解目前資料庫複雜狀態下,首先要讓所有人都

[分享] 腳踏車環島注意事項

很多人都期望自己能夠做點什麼,做些什麼,而退伍之後的第二個星期,就展開了環島之旅。 對很多人來說這不算什麼,甚至有人展開了走路、跑步、溜滑板、單輪車等方式環島一周,充分展現對台灣的愛與關懷。 這篇主要讓不知道怎麼準備環島的人,作一個完善的解說,首先隨身的東西要有: 證件現金類 : 身份證 健保卡 學生證 現金 提款卡 悠遊卡

直播錄影設備大公開 - 從線下轉線上到底要哪些裝備

直播錄影設備分享 蠻多朋友都在敲碗詢問,到底一場直播需要準備哪些設備,這邊聽筆者娓娓道來, 網路 好的網路上天堂,壞的網路會讓你掉落到不知道什麼地方。 會建議大家至少是一個獨立的 4G 訊號,意味著當下至少要有 30MB/s 的上傳下載,這樣在透過 Google Meet / Zoom 視訊會議的時候是比較不會卡頓的狀態。 Google Meet 輔助文件 有提到關於頻寬的最低需求, 對位於 8.8.8.8. 的 Google 公用 DNS 伺服器執行連線偵測 (ping) 測試時,延遲時間應低於 50 毫秒。 參與者的上傳訊號 (無論通訊人數多寡) 應符合 3.2 mbps 的頻寬需求。 抓在這樣的標準之上會是比較穩定的, 如果你的需求是要透過 OBS 同時播出到 youtube live / Facebook live 和多個頻道的時候,會建議需要更高頻寬,最好是連接有線網路的狀況下尤佳。 總之,網路越快越好,直接光纖肯定沒錯!(可惜我家無法 …T_T 麥克風 直接說答案,這邊採用的是   Rode Wireless go 購買網址: https://24h.pchome.com.tw/prod/DGCF07-A900B6O2U 沒有考慮類似圓剛 av310 或者 BlueYite 之類的,主要是因為可能當初規劃會有起身轉場可能,且可以支援一對多的方式進行訪談式收音。 但很可惜的是,沒有朋友!(威 Rode Wireless go 的優勢在於內建獨立麥克風,可直接夾在領夾上,或者連接更好的收音麥克風,當作訊號源來處理,可變化性蠻大的,但對於聲音細緻度,可能就沒辦法要求到這麼多,總之是不同面向考量下的選擇。 燈光 首先燈光會比攝影機要重要許多許多許多,一個好的麥克風,加上好的燈光,基本上背景只要稍微設置一下,就可以美美搭。 6 寸桌上型 LED 網美燈 購買網址: https://24h.pchome.com.tw/prod/DGCF2O-A900AFG98?fq=/S/DGCF2O 道蝦皮找應該可以找到許多更便宜的,以目前來說 6 寸網美 LED 環形燈來說算是堪用,為什麼會說堪用,如果場景允許,實際上再加上左右補光會讓畫面呈現效果更佳。 目前上述的需求,都是以大頭照拍攝,或者半身的需求為主。 如果說要拍到全身的話,基本上就是直上攝影用補光燈,這就不在此範圍內