重定向一切的index.php(Redirection everything to index.php)

   IT问题网   2018-12-07 00:00:00

问 题

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

所以,这样的网址:

`site.com/projects/s01/- > site.com/projects/s01/index.php(原件)`
`site.com/projects/ge5/- > site.com/projects/ge5/index.php(原件)`
`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是在装货也很慢,也许这些文件不会真正去检查,使其更快?什么是最好的方式去了解呢?

解决方案

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

rewriteengine叙述上
的rewritecond%{} request_filename -s [or]
的rewritecond%{} request_filename -l [or]
的rewritecond%{} request_filename -d
。重写规则^ * $-[nc,l]
重写规则^ * $的index.php [nc,l]
 

标签:定向一切



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

生成SE友好的URL的.htaccess国防部重写(Generating SE friendly URL .htaccess mod rewrite)

problem i've a url which get file name through get method ...

htaccess的子域名重定向(htaccess subdomain redirect)

problem i've searched around and tried a few ...

UrlRewrite 3 GET请求(UrlRewrite with 3 get request)

problem i'm working on a project and stuck on urlrewrite. ...

mod_rewrite的:恶意重定向(Mod_ReWrite: Unwanted redirect)

problem possible duplicate: .htaccess, clean ...

限制用户子目录(limiting users to subdirectories)

problem i have a subdirectory of users that i want to lim ...

重定向子文件夹的.htaccess(Redirection Subfolder Htaccess)

problem i want a redirect using htaccess i have a post na ...

使用的.htaccess,从来没有表现出的index.php(Using .htaccess, never show index.php)

problem how can i never show index.phpfor example, all re ...

在子域的内部服务器错误(internal server error in subdomains)

problem i installed worpress to my main domain abcd.com. ...

基于用户代理手机网站重定向(Mobile website redirection based on user agent)

problem say i've got two distinct domains: ...

的Joomla htaccess的不工作(Joomla htaccess not working)

problem i am using joomla 1.7 and using joomla's built in ...

扩大友好的URL,国防部重写(Expanding friendly url, mod rewrite)

problem i am using modx, which is a cms system. it has a ...

共享主机Zend的项目?(zend project on shared hosting )

problem i created a zend project on localhost on ubuntu o ...

URL结构的htaccess(url construction htaccess)

problem lets say i have a link to one of my page that loo ...

htaccess的重写规则(.htaccess RewriteRule)

problem i'm trying to write a rewriterule (with no luck) ...

如何配置.htaccess文件的重写规则摆脱扩展,尾随斜线,WWW?(How to configure .htaccess file for rewrite rules to get rid of extensions, trailing slashes, www)

problem this is what i want - when somebody enters site. ...

htaccess的基础上与通配符和东西后,到index.php index.php页面重定向不存在的页面(.htaccess redirect non existing pages based on index.php page with wildcard and something after it to index.php)

problem please help, some website is arbitrar ...

国防部重写的子域子域目录(mod-rewrite subdomain to subdomain dir)

problem i have a bit of a problem with rewrite rules; so ...

如何使用的.htaccess忽略/删除/页/ X /从网址是什么?(How to use .htaccess to ignore/remove /page/X/ from url)

problem how can i use .htaccess to strip/ignore /page/x/ ...

变化的RewriteBase视域(change RewriteBase depending on domain)

problem i have to set rewritebase depending o ...

字preSS PHP文件执行(Wordpress php file execution)

problem i have a wordpress website (buddypres ...