.htaccess在WampServer 2.5中不起作用 [英] .htaccess doesn't work in WampServer 2.5
问题描述
我在WampServer 2.5中的 .htaccess
遇到了问题。
I have got a problem with .htaccess
in WampServer 2.5.
我使用Windows 10 Enterprise,并且在其上安装 wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b_August_2015
。
I use Windows 10 Enterprise and have installed wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b_August_2015
on it.
除.htaccess配置外,其他所有操作都进行顺利。
我想从网站网址中删除 .php
扩展名,例如(www.mywebsite.com/contact.php)应该看起来像(www.mywebsite.com/contact) ,但它不起作用并显示(404 Not Found错误)。
Every thing is going well except .htaccess configs.
I want .php
extention removed from website url like (www.mywebsite.com/contact.php) should look like (www.mywebsite.com/contact), but it doesn't work and displays (404 Not Found error).
URL链接类似于:
<a href="contact">link</a>
但是在链接上添加.php扩展名时:
But when adding .php extention at the link :
<a href="contact.php">link</a>
它有效。
我在.htaccess中使用了这堆代码:
I use this bunch of codes in my .htaccess :
<IfModule mod_rewrite.c>
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# RewriteBase /
</IfModule>
我也尝试了其他类似上面的代码,但是没有结果。
以前在Windows 8.1和wampserver2.2中是很麻烦的,但是现在在wamp2.5中它给我带来了麻烦。
我应该如何解决?
I also tried some other codes like above, but no results. Previously in windows 8.1 and wampserver2.2 it was waroking, but now in wamp2.5 it puts me in trouble. how should i get it solved?
推荐答案
检查此youtube逐步教程,以启用在wamp中的重写模块apache
https://youtu.be/xIspOX9FuVU?t=1m43s
Wamp服务器图标-> Apache-> Apache模块,然后选中重写模块选项
check this youtube step by step tutorial related to enable rewrite module in wamp apache https://youtu.be/xIspOX9FuVU?t=1m43s Wamp server icon -> Apache -> Apache Modules and check the rewrite module option
这篇关于.htaccess在WampServer 2.5中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!