×

phpstudy开启rewrite

phpstudy开启rewrite(怎么用phpstudy打开已做好的网页)

admin admin 发表于2023-04-06 20:13:08 浏览48 评论0

抢沙发发表评论

本文目录一览:

如何查看开启phpstudy伪静态

打开phpstudy的配置文件。 httpd.conf

在phpStudy\Apache2\conf文件夹里。用记事本就可以了。

或者,你在任务栏点击phpstudy程序图标,选 配置文件,选 httpd.conf

都可以。

然后

搜索 LoadModule rewrite_module modules/mod_rewrite.so

去掉前面的#

搜索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 All

Options None

Order allow,deny

Allow from all

/Directory

改好以后,接着在最后一行添加: (这个是关键点)

IfModule mod_rewrite.c

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topictopic=$2%1

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=viewaid=$2page=$3%1

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplayfid=$2page=$3%1

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthreadtid=$2extra=page\%3D$4page=$3%1-phpstudy开启rewrite

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=groupfid=$2page=$3%1

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space$2=$3%1

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=spaceuid=$2do=blogid=$3%1

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2value=$3%1

RewriteCond %{QUERY_STRING} ^(.*)$

RewriteRule ^(.*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3%1

/IfModule

装的PHPstudy怎么设置虚拟域名

您好,很高兴回答您的问题,希望我的问题能帮到您,谢谢!!!

打开phpstudy,点击mysql管理器,选择站点域名管理

添加你的域名

点击其他选项菜单,找到打开host,然后打开host文件,把域名添加进去

最后重启phpstudy即可

phpstudy伪静态设置该怎么做

一、开启Mod_rewrite模块

点击任务栏中的phpstyudy图标,选择“配置文件”--“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 All

Options None

Order allow,deny

Allow from all

/Directory

二 、在Apache2\conf\httpd.conf 最后一行添加:

IfModule mod_rewrite.c

RewriteEngine On

RewriteRule ^(.*)-htm-(.*)$ $1.php?$2 (这里是httpd.ini里面的伪静态规则)

/IfModule

然后重新Apache后就可以正常使用了。