学习Apache的mod rewrite、access写法
更新时间:2008年09月13日 17:21:02 作者:
Apache的mod_rewrite是提供了强大URL操作的杀手级的模块,可以实现几乎所有你梦想的URL操作类型,其代价是你必须接受其复杂性,因为mod_rewrite的主要障碍就是初学者不容易理解和运用,即使是Apache专家有时也会发掘出mod_rewrite的新用途。
Apache 的 mod rewrite
RewriteEngine On RewriteBase /B2B/website/ RewriteRule ^article-([0-9]+)\.html$ view_details.php?browse=profile&id=$1
以上这个测试通过的。如果不行关键是服务器端,以后的怎么改就发挥了
关于图片的 可以加一个 /503(id)/title.htm 这样一定不重复了,用503或其他数字或者是abc也行,不顾oabc还想不是很理想,学学ii的,他就是用数字的定义所有的功能就行了
这个很有参考价值的
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2
</IfModule>
discuz的
最强wordpress的
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
关键看看 %怎么用了 还有 [...]
RewriteEngine On RewriteBase /B2B/website/ RewriteRule ^article-([0-9]+)\.html$ view_details.php?browse=profile&id=$1
以上这个测试通过的。如果不行关键是服务器端,以后的怎么改就发挥了
关于图片的 可以加一个 /503(id)/title.htm 这样一定不重复了,用503或其他数字或者是abc也行,不顾oabc还想不是很理想,学学ii的,他就是用数字的定义所有的功能就行了
这个很有参考价值的
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2
</IfModule>
discuz的
最强wordpress的
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
关键看看 %怎么用了 还有 [...]
您可能感兴趣的文章:
- apache的rewrite规则使用说明
- 开启Apache mod_rewrite模块示例代码
- 13个实用的Apache Rewrite重写规则
- 浅谈apache和nginx的rewrite的区别
- Apache Rewrite实现URL的301跳转和域名跳转
- Apache Rewrite url重定向功能的简单配置
- 让Apache支持Rewrite静态页面重写的方法
- Linux下Apache安装/增加mod_rewrite模块的方法
- Apache rewrite的重写相关的参数说明
- Apache rewrite重写规则的常见应用
- apache rewrite_module模块使用教程
- 用ISAPI_Rewrite让IIS也支持如Apache下.htaccess的URL重写
- apache rewrite规则实现白名单
相关文章
centos redhat系列对抗ddos之居家必备利器 banip.txt
本文可以用于redhat centos 系列 linux 系统的 屏蔽多连接ip,具有抗ddos功能的代码。2010-11-11
Linux下用dnsmasq做dns cache server的配置方法
最近国外的服务器本地DNS总是出故障,闪断一会儿都会影响业务。于是在机房里找了两台Server,安装上keepalived和dnsmasq实际本地的DNS缓存2014-08-08
linux如何mount挂载磁盘并设置开机自动mount的实现
这篇文章主要介绍了linux如何mount挂载磁盘并设置开机自动mount的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2019-09-09
如何在Linux中route add命令添加路由(Linux route)
route add命令是用于管理Linux操作系统网络路由,允许用户添加、删除或修改网络路由表中的条目,在Linux系统上添加静态路由,静态路由是手动配置的路由,它指定了数据包从一个网络到达另一个网络的路径,通过添加静态路由,可实现网络分段、转发和通信等2024-06-06


最新评论