mod_rewrite
Apache HTTP Server
Enable htaccess on Apache
1. uncomment this line in httpd.conf:
LoadModule rewrite_module modules/mod_rewrite.so
2. change directory setting in httpd.conf:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>
Configures what features are available in a particular directory
Options 属性:
Indexes 当该目录下没有index.*时则以ftp-style列出该目录下所有文件
Includes Allow server-wide includes
FollowSymLinks 当该目录下软连接的文件/目录链接到外部目录时,仍然可以正常显示。
MultiViews 由一个*.var管理同一网页的多种语言版本,如apache默认主页多种语言的index.html
ExecCGI 允许执行CGI程序
ALL 开启除MultiViews之外的属性
None 禁止所有属性
AllowOverride 是否允许使用.htaccess覆盖某些设定(All None FileInfo AuthConfig Limit)
Order allow,deny : 控制访问权限
Order deny,allow
deny from test.org 拒绝test.org访问
deny from 192.168.0.100 拒绝192.168.0.100访问
allow from 192.168.0.1 允许192.168.0.1 访问
http://httpd.apache.org/docs/2.0/mod/core.html
http://m.oschina.net/bbs/thread/176
authentication
http://www.htaccesstools.com/htaccess-authentication/
.htaccess
Reference:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
Examples:
http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html
http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide_advanced.html
http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html#default-mod-rewrite-hint
http://www.webmasterworld.com/forum92/2524.htm
Tools:
http://cooletips.de/htaccess/
http://www.htaccesstools.com/
usually it is used to transfer from static URL to dynamic URL
#Error pages
ErrorDocument 404 http://www.backbase.com/errors/404.php
RewriteRule directives
last|L' (last rule)
Stop the rewriting process here and don't apply any more rewrite rules. This corresponds to the Perl last command or the break command in C. Use this flag to prevent the currently rewritten URL from being rewritten further by following rules. Remember, however, that if the RewriteRule generates an internal redirect (which frequently occurs when rewriting in a per-directory context), this will reinject the request and will cause processing to be repeated starting from the first RewriteRule.
'next|N' (next round)
Re-run the rewriting process (starting again with the first rewriting rule). This time, the URL to match is no longer the original URL, but rather the URL returned by the last rewriting rule. This corresponds to the Perl next command or the continue command in C. Use this flag to restart the rewriting process - to immediately go to the top of the loop. Be careful not to create an infinite loop!
'nocase|NC' (no case)
This makes the Pattern case-insensitive, ignoring difference between 'A-Z' and 'a-z' when Pattern is matched against the current URL.
'noescape|NE' (no URI escaping of output)
This flag prevents mod_rewrite from applying the usual URI escaping rules to the result of a rewrite. Ordinarily, special characters (such as '%', '$', ';', and so on) will be escaped into their hexcode equivalents ('%25', '%24', and '%3B', respectively); this flag prevents this from happening. This allows percent symbols to appear in the output, as in
RewriteRule /foo/(.*) /bar?arg=P1/%3d$1 [R,NE]
which would turn '/foo/zed' into a safe request for '/bar?arg=P1=zed'.
'redirect|R [=code]' (force redirect)
Prefix Substitution with http://thishost[:thisport]/ (which makes the new URL a URI) to force a external redirection. If no code is given, a HTTP response of 302 (MOVED TEMPORARILY) will be returned. If you want to use other response codes, simply specify the appropriate number or use one of the following symbolic names: temp (default), permanent, seeother. Use this for rules to canonicalize the URL and return it to the client - to translate ``/~'' into ``/u/'', or to always append a slash to /u/user, etc.
Note: When you use this flag, make sure that the substitution field is a valid URL! Otherwise, you will be redirecting to an invalid location. Remember that this flag on its own will only prepend http://thishost[:thisport]/ to the URL, and rewriting will continue. Usually, you will want to stop rewriting at this point, and redirect immediately. To stop rewriting, you should add the 'L' flag.
While this is typically used for redirects, any valid status code can be given here. If the status code is outside the redirect range (300-399), then the Substitution string is dropped and rewriting is stopped as if the L flag was used.
RewriteCond directives
used before RewriteRule directives
# RewriteRule backreferences: These are backreferences of the form $N (0 <= N <= 9), which provide access to the grouped parts (in parentheses) of the pattern, from the RewriteRule which is subject to the current set of RewriteCond conditions..
# RewriteCond backreferences: These are backreferences of the form %N (1 <= N <= 9), which provide access to the grouped parts (again, in parentheses) of the pattern, from the last matched RewriteCond in the current set of conditions.
# RewriteMap expansions: These are expansions of the form ${mapname:key|default}. See the documentation for RewriteMap for more details.
# Server-Variables: These are variables of the form %{ NAME_OF_VARIABLE } where NAME_OF_VARIABLE can be a string taken from the following list:
HTTP headers: connection & request:
HTTP_USER_AGENT
HTTP_REFERER
HTTP_COOKIE
HTTP_FORWARDED
HTTP_HOST
HTTP_PROXY_CONNECTION
HTTP_ACCEPT
REMOTE_ADDR
REMOTE_HOST
REMOTE_PORT
REMOTE_USER
REMOTE_IDENT
REQUEST_METHOD
SCRIPT_FILENAME
PATH_INFO
QUERY_STRING
AUTH_TYPE
server internals: system stuff: specials:
DOCUMENT_ROOT
SERVER_ADMIN
SERVER_NAME
SERVER_ADDR
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
TIME_YEAR
TIME_MON
TIME_DAY
TIME_HOUR
TIME_MIN
TIME_SEC
TIME_WDAY
TIME
API_VERSION
THE_REQUEST
REQUEST_URI
REQUEST_FILENAME
IS_SUBREQ
HTTPS
分享到:
相关推荐
* @title Check if Apache's mod_rewrite is installed. * * @author Pierre-Henry Soria * @copyright (c) 2013, Pierre-Henry Soria. All Rights Reserved. * @return boolean */ function isRewriteMod() ...
主要介绍了如何开启Apache mod_rewrite模块,需要的朋友可以参考下
这时候你可以用以下的方式来做到:(Apache mod_rewrite) RewriteEngine On RewriteBase / RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://jb51.net/$1 [R=301,L] 把这段代码放在.htaccess文件...
MOD_REWRITE
它的行为是像Apache的mod_Rewrite ,但专为微软的Internet信息服务( IIS ) 。 ISAPI_Rewrite是一个ISAPI筛选器的书面纯的C / C + +所以速度极快。 ISAPI_Rewrite让您的自由,超出标准网址计划和发展自己的计划。 ...
Apache Mod_Rewrite Terrafrom自动化 Bash脚本从用户那里获取变量,然后调用terraform脚本以在C2服务器之前使用mod_rewrite自动启动apache2。 现在,此仓库支持在Linode或Digital Ocean中站起来的重定向器,并且我有...
利用内部的映射函数扩展Apache的mod_rewrite.zip
如果你的服务器apache还没有安装,那很简单,在编译apache时将mod_rewrite模块编译进去就可以,相关文档可以在http://man.chinaunix.net/newsoft …… ew/mod/mod_rewrite. html中找到。如果你的apache已经安装好了...
apache win32 2_0_58 mod_rewrite exploit VC++代码, 可以到www.horseb.org的"原创源码"里下载
它非常类似于Apache's mod_Rewrite,但它是专为IIS设计的。 也是大家常说的URL 静态化了 ISAPI_Rewrite完全版:具有完整功能的版本(无任何限制)。 使用方法: 1、将下载文件解压安装,安装过程中你可以自己...
apache_rewrite语法的详细解析,实现php的URL重写。
mod_rewrite - Apache HTTP服务器.pdf
主要介绍了Apache mod_rewrite中的REQUEST_URI使用实例,本文使用一个实例讲解如何使用REQUEST_URI,需要的朋友可以参考下
经测试过的ISAPI_Rewrite组件,可正常使用,已正常网站伪静态化及反向代理。
Apache的mod_rewrite功能可以说是相当的强大,其可以实现伪装静态URL以达到某些要求(譬如说SEO)。Wordpress也对此功能提供支持,在”设置-永久链接”中我们可以自定义永久链接结构。不过这一切都是基于mod_rewrite,...
2、在将Rewrite破解文件夹中的dll文件覆盖到程序安装目录下ISAPI_Rewrite.dll和ISAPI_RewriteSnapin.dll,如果提示在使用则把要覆盖的dll文件重命名在复制即可; 3、打开安装目录下的httpd.conf文件,在里面输入...
ISAPI_Rewrite 3.1 Full版破解版 ISAPI_Rewrite是用来做什么的请大家自己去百度,我这里不作说明。 附件下载 uploadfile/ISAPI_Rewrite3_0067.msi(文件大小:3.42MB 下载次数:368) 这个软件不需要注册码就能用,...