重定向一切的index.php [英] Redirection everything to index.php

查看:168
本文介绍了重定向一切的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我wan't重定向一切的index.php exepept如果一个文件或目录是否存在。我try'd从谷歌的一些方法,但确实减慢了网站下来,真的不工作,所以我觉得好笑,我得到的东西错了。

I wan't to redirect everything to index.php exepept if a file or directory exists. I try'd a few ways from Google, but that really slowed the website down and don't really work so i amused that i got things wrong.

所以,这样的网址:


    `site.com/Projects/S01/ -> site.com/Projects/S01/index.php (original)`
    `site.com/Projects/GE5/ -> site.com/Projects/GE5/index.php (original)`
    `site.com/Projects/     -> site.com/index.php`
    `site.com/Websites/     -> site.com/index.php`
    `sits.com/Testifcate/   -> site.com/index.php`

请告诉我这样做的最快方法是什么?所有我try'd的方法是很慢的。 感谢您。文件等的main.css是在装货也很慢,也许这些文件不会真正去检查,使其更快?什么是最好的方式去了解呢?

Whats the fastest way of doing this? All the methods I try'd are really slow. Thanks you. Files such as main.css are really slow at loading also, maybe those files don't go true the check to make it faster? What the best way to go about this?

推荐答案

这是我重写规则做到了这一点:

This is my rewrite rule that does just that:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

这篇关于重定向一切的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆