htaccess文件在localhost中不起作用 [英] htaccess file not working in localhost

查看:114
本文介绍了htaccess文件在localhost中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用wamp服务器在Windows XP中工作.我想使用.htaccess文件来操纵URL.
我从Apachi模块列表中启用了rewrite_module.然后,我将.htaccess文件放在根目录中.

我的.htaccess文件包含

I am working in Windows XP using wamp server. I want to use the .htaccess file to manipulate the URL.
I enabled the rewrite_module from the Apachi Module List. Then I put the .htaccess file in root directory.

My .htaccess file contains

RewriteEngine On 
RewriteRule ^movies/([A-Za-z0-9-]+)/?$ movies.php?moviename=$1 [NC,L]




但是在完成所有这些之后.对我的网页没有任何影响.它们的工作方式与以前相同.没有错误,没有区别.

我不明白为什么.htaccess无法正常工作.




But after doing all this. There is no effect on my web pages. They are working the same as earlier. No Error, No Difference.

I can''t understand why .htaccess is not working.

Can any one explain??

推荐答案

movies.php?moviename =
movies.php?moviename=


1 [NC,L]




但是在完成所有这些之后.对我的网页没有任何影响.它们的工作方式与以前相同.没有错误,没有区别.

我不明白为什么.htaccess无法正常工作.

谁能解释?




But after doing all this. There is no effect on my web pages. They are working the same as earlier. No Error, No Difference.

I can''t understand why .htaccess is not working.

Can any one explain??


我刚刚用自己的重写规则在自己的计算机上进行了检查,并且似乎可以正常工作.我尝试使用此URL(我的本地主机):

I just checked on my own machine with your re-write rule and it seems to be working. I tried with this URL (my localhost) :

http://.../SlidingPanel/movies/sgsfgsfs



它能够按照您的期望将我转发到Movies.php页面.您可以分享无法使用的网址吗?另外,请确认您已在Apache服务器上启用rewrite_module,并检查httpd.conf文件以确保没有#",即在此行的开头加上了注释:



and it was able to forward me to the movies.php page as you would expect. Can you share the URL that''s not working? Also, confirm that you have enabled the rewrite_module on Apache server and also check your httpd.conf file to make sure that there is no "#" i.e. commented at the beginning of this line :

LoadModule rewrite_module modules/mod_rewrite.so



似乎有点怪异,但".htaccess"不应在."之前有任何内容,htaccess本身不是扩展名,而是文件名.请确保是这种情况.

最后,当一切就绪后,重新启动Apache服务器...让我们知道它是否有效.

干杯...

如果仍然无法正常运行,请查看Apache错误日志.



It might seem a little weird, but the ".htaccess" should not have anything before the ".", htaccess is not an extension but a filename in itself. Please make sure thats the case.

Finally, when all is in place, restart the Apache server...Let us know if it worked.

Cheers...

have a look at the Apache error logs as well, if it still doesn''t work.


这篇关于htaccess文件在localhost中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆