配置搜索引擎友好的网址(mod_rewrite的) [英] configuring search engine friendly url (mod_rewrite)

查看:121
本文介绍了配置搜索引擎友好的网址(mod_rewrite的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解如何在的.htaccess 工作至少升技。我现在用的的.htaccess 从Zend框架(因为这就是我经常使用)

i want to understand at least abit on how the .htaccess works. i am using the .htaccess from zend framework (since thats what i use often)

SetEnv APPLICATION_ENV development

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

1号线来设置环境变量,确定简单enuf,但什么后续行吗?最新的 -s -l [NC,L] 等的。从阿帕奇文档我可以看到,


  • -s - 指的是一个尺寸常规文件。只是好奇,是有一个非普通文件?

  • -l <​​/ code> - 指的是一个符号链接 - 这什么

  • -d - 指directiory

  • REQUEST_FILENAME - 完整的本地文件系统中的文件路径或脚本匹配请求

  • REQUEST_URI - 在HTTP请求行请求的资源

  • -s - refers to a "regular file with a size". just curious is there a non-regular file?
  • -l - refers to a symbolic link - whats that
  • -d - refers to a directiory
  • REQUEST_FILENAME - full local filesystem path to the file or script matching the request
  • REQUEST_URI - resource requested in the HTTP request line.

假设我浏览到的http://本地主机/一些/路径/此处。什么会 REQUEST_FILENAME &安培; REQUEST_URI 等于?

assuming i browsed to "http://localhost/some/path/here". what will REQUEST_FILENAME & REQUEST_URI equals to?

反正我间preT规则目前为

anyway, i interpret the rules currently as


  • 如果请求的是与大小的文件或

  • 如果请求的是一个链接或

  • 如果请求的是一个目录

  • ...做些什么...

  • 什么重写规则^ * $ - [NC,L] 吗?

  • 那么我想的一切路由匹配上面的index.php规则

推荐答案

如果URL指向一个真实的文件/目录/链接,服务URL作为是(第一行重写规则不改变网址的话)。否则,重定向到的index.php。

If the URL points to a real file/dir/link, serve the URL as is (the first RewriteRule line does not change the URL at all). Else, redirect to index.php.

这篇关于配置搜索引擎友好的网址(mod_rewrite的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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