隐藏“www.blahblah.com/index.php”中的“index.php”

时间:2014-11-23 05:35:12

标签: php .htaccess

我想隐藏" index.php"来自" www.blahblah.com/index.php" ;?怎么做?

请帮忙,我现在有很多代码计划隐藏index.php的网址。我用Google搜索,发现您首先需要创建.htaccess文件。但我不知道从哪里开始呢?我是否需要与我的项目一起创建该文件?在该文件中输入什么内容?

1 个答案:

答案 0 :(得分:3)

创建.htaccess文件,然后复制下面的代码 更改' project_folder_name'你的项目的文件夹 如果您的项目位于根文件夹中,则只需输入' /'

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /project_folder_name

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
相关问题