redirect on home page when user write index file name in url

时间:2017-08-04 12:51:33

标签: php .htaccess redirect

Bellow is my site directory structure:

 project-folder/
          index.php

Now I have access project using folder name like www.project-folder.com and also www.folder-name.com/index.php

Problem

If some one user enter www.folder-name.com/index.php in URL then redirect on www.project-folder.com using htaccess.

How can I do this ?

Below line is I tried in htaccess

Directory Index public/index.php

1 个答案:

答案 0 :(得分:0)

www.folder-name.com

的htaccess文件中使用此功能
Redirect index.php http://www.project-folder.com/index.php

为避免混淆,请使用此类重定向:

Redirect /path/to/old/file/old.php http://www.redirectedwebsite.com/path/to/new/file/new.php