如题所述
一 开启Mod_rewrite模块打开Apache2\conf\httpd.conf搜索 LoadModule rewrite_module modules/mod_rewrite.so (Apache2是这个)去掉前面的#搜索AllowOverride None 替换为 AllowOverride All有好几个找到和下面代码类似的那个</IfModule## "D:\usr\local\Apache2\cgi-bin" should be changed to whatever your ScriptAliased# CGI directory exists, if you have that configured.#<Directory "D:\usr\local\Apache2\cgi-bin"AllowOverride AllOptions NoneOrder allow,denyAllow from all</Directory二 在Apache2\conf\httpd.conf 最后一行添加<IfModule mod_rewrite.cRewriteEngine OnRewriteRule ^(.*)-htm-(.*)$ $1.php?$2
温馨提示:答案为网友推荐,仅供参考
第1个回答 2018-04-12
<VirtualHost *:80>
DocumentRoot D:/www
ServerName localhost
RewriteEngine on
#规则放在下面即可
</VirtualHost>
可以对每个虚拟主机做单独的URL Rewrite
自己创建一个.htaccess或从godaddy空间backups文件夹中拷贝一个出来到网站根目录,打开并添加如下代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
</IfModule>
保存。
OK!
本回答被网友采纳