在 apache localhost 服务器上使用 .htaccess 文件 [英] Use .htaccess file on an apache localhost server
问题描述
好的,我安装了一个 Apache localhost 服务器并运行 PHP 和 MySql.现在我希望能够使用 .htaccess
文件以及使用 RewriteRule
,但我不知道把它放在哪里.
Alright, I got an Apache localhost server up and running with PHP and MySql. Now I want to be able to use a .htaccess
file as well to use RewriteRule
, But I'm at a loss where to put it.
我有这些目录:
C:\dev\progs
Apache PHP 和 MySQL 的存储位置,每个都在它们自己的子目录中,即.C:\dev\progs\Apache
等等...
C:\dev\progs
where Apache PHP and MySQL are stored, each in their own sub-directories, ie. C:\dev\progs\Apache
and so on...
C:\dev\www
存放所有站点文件的地方.
C:\dev\www
where all the site files are stored.
我需要知道 .htaccess
文件放在哪里,我需要做哪些配置,以及我的希望和梦想是否都落空了.
I need to know where to put the .htaccess
file, what configuration I need to do, and if what I'm my hopes and dreams are all for nothing.
谢谢
推荐答案
.htaccess 是一个配置文件,应该存储在您的页面所在的位置.简而言之,它应该在 c:\dev\www
在你的情况下,但你应该阅读 这个 也是.顺便说一句,不要忘记通过从它所在的行中删除一个哈希来打开 mod_rewrite
.htaccess is a configuration file that should be stored where your page is. In short, it should be in c:\dev\www
in Your case, but You should read this too. BTW don't forget to turn on mod_rewrite by deleting a hash from the line where it resides
LoadModule rewrite_module modules/mod_rewrite.so
并通过更改启用 .htaccess
and enable .htaccess by changing
AllowOverride None
到
AllowOverride All
这篇关于在 apache localhost 服务器上使用 .htaccess 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!