WAMP 2.4上的Mod

编程入门 行业动态 更新时间:2024-10-27 11:25:01
本文介绍了WAMP 2.4上的Mod_rewrite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有wampserver 2.4,但似乎无法让Mod_Rewrite对其进行工作.我已经在Apache服务中启用了它,并在httpd.conf中取消了对mod_rewrite.so的注释,然后重新启动了服务器.我还检查了我的phpinfo(),它在服务下列出了mod_rewrite.

I have wampserver 2.4 and I can not seem to get Mod_Rewrite to work on it. I have enabled it in the Apache services and uncommented the mod_rewrite.so in the httpd.conf and restarted the server. I also checked my phpinfo() and it listed mod_rewrite under services.

我要对其进行测试的网站位于地址localhost/eb/index.php的后面,我试图在event.php页面上对其进行测试,其中的URL看起来像localhost/eb/event.php?id = 1

The site I am testing it on is behind the address localhost/eb/index.php I was trying to test it on the event.php page in which the url looks like localhost/eb/event.php?id=1

这是我的.htaccess文件在index.php文件所在的localhost/eb根目录中的样子.

This is what my .htaccess file looks like in the root of localhost/eb where my index.php file is located.

<IfModule mod_rewrite.so> RewriteEngine on RewriteBase /eb/ RewriteRule ^event/([0-9]+)/?$event.php?id=$1 </IfModule>

即使在此之后,它仍然显示url localhost/eb/event.php?id = 1

Even after this it still displays the url localhost/eb/event.php?id=1

推荐答案

您还需要额外的外部重定向.保持您的.htaccess如下:

You need an additional for external redirect also. Keep your .htaccess like this:

Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase /eb/ RewriteCond %{THE_REQUEST} /event\.php\?id=([^\s&]+) [NC] RewriteRule ^ event/%1? [R=301,L] RewriteRule ^event/([0-9]+)/?$ event.php?id=$1 [L,QSA]

更多推荐

WAMP 2.4上的Mod

本文发布于:2023-10-20 08:54:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1510506.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:WAMP   Mod

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!