帮助写一个htaccess [英] Help writing an htaccess
本文介绍了帮助写一个htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将所有的页面重定向到我的index.php,这样我就可以解析URL和处理剩下的一个htaccess文件。我只是不知道怎么写呢。
I'd like an htaccess file that would redirect all pages to my index.php so that I can then parse the url and handle the rest. I just don't know how to write it.
感谢
推荐答案
如果你谷歌周围,你会发现不同的方式去做。这是我做的(与Zend框架)的方式。
If you Google around, you'll find various way to do it. This the way I do it (same as Zend Framework).
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
希望它帮助。
Hope it helps.
这篇关于帮助写一个htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文