在apache localhost服务器上使用.htaccess文件

KFo*_*Fox 10 apache directory .htaccess configuration localhost

好吧,我得到了一个Apache localhost服务器并运行PHP和MySql.现在我希望能够使用一个.htaccess文件来使用RewriteRule,但是我不知道该把它放在哪里.

我有这些目录:

C:\dev\progs存储Apache PHP和MySQL的地方,每个都存放在自己的子目录中,即.C:\dev\progs\Apache等等...

C:\dev\www 存储所有站点文件的位置.

我需要知道把.htaccess文件放在哪里,我需要做什么配置,以及我的希望和梦想是什么都没有.

谢谢

Gau*_*g P 14

在localhost中的apache服务器上启用.htaccess

1) Find your apache directly which uses the php installation .
2) Open your httpd.conf  with notepad, Which is located in the path \apache\conf directory
3) Find the code like below       
      #LoadModule rewrite_module modules/mod_rewrite.so
4) Remove # from above code


# AllowOverride controls what directives may be placed in .htaccess files.
 # It can be "All", "None", or any combination of the keywords:
 #   Options FileInfo AuthConfig Limit
 #
 AllowOverride All   <--- make sure this is not set to "None"


5) Save httpd.conf file
6) Restart your apache server
Run Code Online (Sandbox Code Playgroud)


Kit*_*tet 13

.htaccess是一个配置文件,应存储在您的页面所在的位置.简而言之,它应该c:\dev\www在你的情况下,但你也应该读这个.BTW不要忘记通过从它所在的行中删除一个哈希来打开mod_rewrite

LoadModule rewrite_module modules/mod_rewrite.so
Run Code Online (Sandbox Code Playgroud)

并通过更改启用.htaccess

AllowOverride None
Run Code Online (Sandbox Code Playgroud)

AllowOverride All
Run Code Online (Sandbox Code Playgroud)