htaccess的URL路由的PHP MVC?(htaccess URL routing for PHP MVC)

   IT问题网   2019-08-16 00:00:00

问 题

我一直在寻找,并还没有找到一篇文章,以帮助我。我很熟悉,当涉及到的htaccess的文件重写引擎,和我目前正在开发一个php mvc框架。

基本上,从网络服务器的根目录下,我需要他们的控制器的所有页面请求/ url中的操作重定向到应用程序/ index.php的

因此,例如site.com/login/就直接到的index.php,和uri显然被解析用php来制定登录控制器通过后的数据。

解决方案

我觉得'平常'的方式是转发的不存在的文件和目录到控制器的所有请求:

 的rewritecond%{} request_filename!-f
的rewritecond%{} request_filename!-d
重写规则^应用/的index.php [l]
 

标签:路由



分享:

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


热门推荐

的.htaccess规则相应的HTTP链接,HTTP和HTTPS重定向到HTTPS?(.Htaccess rules to redirect respective HTTP links to HTTP and HTTPS to HTTPS)

problem first, here's the .htaccess rule i cu ...

使用的.htaccess追加html的URL路径的背后(using .htaccess to append .html behind url path)

problem people are coming into my website like this: sit ...

的.htaccess迫使对SSL错误页面(.htaccess forcing error pages on SSL)

problem i have the following piece of code in ...

可变301重定向URL(301 redirect URL with variable)

problem i want to use htaccess to 301 redirect (not rewri ...

htaccess的重定向example.com/index.php到example.com/home~~V(htaccess redirect example.com/index.php to example.com/home)

problem thanks in advance, i am trying to redirect anyone ...

htaccess的重写规则问题(.htaccess Rewrite Rule Problems)

problem can anyone help me with htaccess rewr ...

htaccess的子域名与所有的变量文件参数(.htaccess sub domain as file parameter with all the variables)

problem i want to make this url redirect usin ...

字preSS定制的mod_rewrite - totalnoob?(Wordpress custom mod_rewrite - totalnoob)

problem i'm trying to make a custom mod_rewrite rule for ...

我怎样才能让我的网址,从这个例子中友好吗?(How can I make my urls friendly from this example)

problem my site currently displays like this (when clicki ...

htaccess的问题强制SSL(.htaccess issue to force SSL)

problem i activated ssl on one of my sites (based on word ...

IfModule不会出现是工作?(IfModule doesn't appear to be working)

problem if i use this: lt;ifmodule mod_rewrite.cgt; rewr ...

我怎样才能利用外界信息的URL重写?(How can I get use outside information in url rewrites)

problem hopefully some of you .htaccess gurus can help me ...

基于URL到一个新的页面的RewriteCond重写规则进行的.htaccess,定期EX pression(RewriteCond RewriteRule for .htaccess based on URL to a new page, regular expression)

problem i have an interesting rewriterule and i am not su ...

的.htaccess,mod_rewrite的,正则表达式用目录和文件类型(.htaccess, mod_rewrite, regex with directory and filetype)

problem i want to do a rewrite with the following conditi ...

.htaccess的语言重定向310错误(Htaccess language Redirect 310 error)

problem i have a two language site swedish sidewww.site ...

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

problem i wan't to redirect everything to index.php exepe ...

生成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 ...