Home >Backend Development >PHP Tutorial >How Can I Remove index.php from URLs in CodeIgniter 2 When Using a Subfolder?

How Can I Remove index.php from URLs in CodeIgniter 2 When Using a Subfolder?

Susan Sarandon
Susan SarandonOriginal
2024-11-18 02:46:02988browse

How Can I Remove index.php from URLs in CodeIgniter 2 When Using a Subfolder?

Removing index.php from URLs in Codeigniter 2

Problem:

Users encounter difficulties removing index.php from URLs in Codeigniter 2, despite attempts to implement existing solutions.

Solution:

To resolve this issue, try the following:

  1. Use the first code block provided in the original post.
  2. Replace "/index.php" in the RewriteRule line with "/(site)/index.php".
  3. Replace "(site)" with the name of your website's root folder.

This modification accounts for the specific file structure of your website, where the index.php file is located within a subfolder. The updated .htaccess code will correctly redirect requests to the desired location.

The above is the detailed content of How Can I Remove index.php from URLs in CodeIgniter 2 When Using a Subfolder?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn