网站重定向

时间:2011-02-22 22:10:31

标签: php .htaccess redirect

我的问题很简单。我有我的主页(www.domain.com/index.php)

  1. 当他只输入www.domain.com时,有没有办法将用户重定向到/index.php?

  2. 还可以在网址上删除网址中的index.php吗?

  3. 我检查了一下.htaccess,但似乎没有任何技巧。

    谢谢!

    修改

    这是我的.htaccess:

    # To set your custom php.ini, add the following line to this file:
    # suphp_configpath /home/yourusername/path/to/php.ini
    
    DirectoryIndex index.php
    
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>
    
    Options All -Indexes
    

    正如您所看到的,我将DirectoryIndex index.php放入其中,但不会更改它:(

4 个答案:

答案 0 :(得分:3)

简单地说

DirectoryIndex index.php
你的.htaccess

中的

当用户输入 www.domain.com 时,它会将 index.php 作为默认索引页面,并且不会显示在地址中

答案 1 :(得分:0)

域控制面板中的

提到Start / Index页面为index.php。 通常index.html / htm是默认页面。 您将在site proerties下找到这些选项。

答案 2 :(得分:0)

Redirect / http:/your.domain.php/index.php

答案 3 :(得分:0)

RewriteEngine On
RewriteBase /   # URL path corresponding to this directory
RewriteRule (^|.*/)index\.php$ $1 [R]
相关问题