问题描述
我搜索网页2天,我尝试使用htaccess的在我的本地瓦帕,但我不能!我知道有一些错误,但我不知道在哪里......
第一:我激活的 rewrite_module 的在Apache菜单,然后我检查的phpinfo网页,我看到那个模块添加到它的的加载模块的一部分。
二:我检查了httpd.conf中,并取得了一定的变化,这是结果(只是重要的部分):
的ServerRootC:/ Program Files文件/ WAMP /斌/阿帕奇/ apache2.2.11
听80
服务器名本地主机:80
的DocumentRootC:/ Program Files文件/ WAMP / WWW /
<目录/>
有FollowSymLinks
#设置AllowOverride无
#订单拒绝,允许
#所有拒绝
所有的AllowOverride
订购允许,拒绝
所有允许
< /目录>
<目录C:/ Program Files文件/ WAMP / WWW />
选择指标的FollowSymLinks
所有的AllowOverride
订购允许,拒绝
所有允许
< /目录>
的LoadModule alias_module模块/ mod_alias.so
的LoadModule rewrite_module模块/ mod_rewrite.so
下一步:我做了一个别名到我的工作区。下面是它的.conf文件的内容:
别名/ basic_test /E:/项目/ basic_test /
<目录E:/项目/ basic_test />
选择了FollowSymLinks指标多视图
所有的AllowOverride
订购允许,拒绝
所有允许
< /目录>
下一步:我把一个简单的的index.php和test.php的我的工作区根和测试别名这个地址: - >本地主机/ basic_test / index.php文件的 - >本地主机/ basic_test / test.php的的他们的工作完美...
最后,我增加了一个htaccess的文件到我的工作区的根(的index.php旁),我在里面写道:
< IfModule mod_rewrite.c>
RewriteEngine叙述上
重写规则^的index.php $ test.php的
< / IfModule>
但在问题发生了,当我试图测试的.htaccess
由该地址: - >本地主机/ basic_test / index.php文件的
这表明这一消息的错误页面:哎呀!此链接似乎被打破。
在此先感谢您的时间和帮助......
RewriteEngine叙述上
的RewriteBase / basic_test /
重写规则^的index.php $ test.php的
I searched in web for 2 days and I try to use htaccess in my local wamp but I can't! I know there is something wrong but I don't know where...
First: I activated "rewrite_module" in the apache menu, then I checked the phpinfo page and I saw that module added to its "Loaded Modules" part.
Second: I checked the httpd.conf and made some changes, it is the result (just important parts):
ServerRoot "c:/program Files/wamp/bin/apache/apache2.2.11"
Listen 80
ServerName localhost:80
DocumentRoot "c:/program Files/wamp/www/"
<Directory />
Options FollowSymLinks
# AllowOverride None
# Order deny,allow
# Deny from all
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
<Directory "c:/program Files/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
Next: I made an alias to my workspace. Here is contents of its .conf file:
Alias /basic_test/ "e:/Projects/basic_test/"
<Directory "e:/Projects/basic_test/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
Next: I place a simple "index.php" and "test.php" in my workspace root and tested the alias by this addresses:--> "localhost/basic_test/index.php"--> "localhost/basic_test/test.php"They worked perfectly...
Finally, I added a ".htaccess" file to the root of my workspace (beside index.php), and I wrote in it:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^index.php$ test.php
</IfModule>
But the problem occurred when I tried to test the ".htaccess
" by this address:--> "localhost/basic_test/index.php"
It show an error page with this message:Oops! This link appears to be broken.
Thanks in advance for your time and help...
RewriteEngine on
RewriteBase /basic_test/
RewriteRule ^index.php$ test.php
这篇关于如何使用的.htaccess在WAMP的服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!