配置过程如下:
Apache 开启如下模块:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
在配置文件中加入下列语句:
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
找到
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
将None改为All
找到
<Directory "D:/web/apache/htdocs">
......
AllowOverride None
......
</Directory>
将None也改为All
启用PHP:
LoadModule php5_module D:/web/php/php5apache2_2.dll
PHPIniDir D:/web/php
AddType application/x-httpd-php .php
试着在网站根目录建一个..htaccess文件,windows下无法建立,方法不详!
如下:
RewriteEngine on
RewriteBase /
RewriteRule ^(/d{1,6})([sb]{1})_(/w+)_.*/.bmp$ http://localhost/plus/getsimg.php?id=$1&imgtype=$2&PingYinName=$3 [L]
RewriteRule ^(/d{1,6})_.*/.swf$ http://localhost/plus/getflash.php?id=$1 [L]
RewriteRule ^(/d{1,3})_(/d{1,3})_(/d{1,3})_/w*_/w*_(/w*)/.html$ http://localhost/plus/redirect.php?cid=$1&TotalResult=$2&PageNo=$3&PingYinName=$4 [P]
RewriteRule ^(/d{1,3})_/w+_(/d{1,6})_/w+/.html$ http://localhost/plus/redirect.php?cid=$1&aid=$2 [P]
RewriteRule ^(/d{1,3})_/w*_/w*_(/w*)/.html$ http://localhost/plus/redirect.php?cid=$1&PingYinName=$2 [P]
RewriteRule ^special_game_[^_]*_(_.*)_(/d{1,4})/.html$ http://localhost/plus/to_tags_php.php?/$1/$2/ [P]
涉及正则表达式,正则表达式有点麻烦,须花时间研究!通过以上步骤便可实现重写了...