问题描述
我有这样的网址的http://localhost/mysite/index.php页=东西
,我只是想成为 HTTP? //本地主机/ mysite的/东西
,并在主页上它应该是的http://本地主机/ mysite的/
不是 HTTP ://localhost/mysite/index.php
使用的.htaccess
I have urls like this http://localhost/mysite/index.php?page=something
which I only want to be http://localhost/mysite/something
and on the homepage it should be http://localhost/mysite/
not http://localhost/mysite/index.php
by using .htaccess
下面是我的code。在.htaccess文件:
Below is my code in .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
rewriterule ^([^-]+)$ index.php?page=$1[L]
</IfModule>
但它显示了相同的哪些已经之前。我不知道,如果我写的东西错了code以上或者我的Apache不支持它,因为我从来没有知道这一点。
But it shows the same to what has been before. I don't know if I wrote something wrong to the code above or maybe my apache does not support it because I never knew it before.
有人能帮助我解决此问题?
Could someone help me to solve this?
推荐答案
如果&LT; IfModule mod_rewrite.c&GT;
失败,那么你不必重写模块编译Apache的,或者未加载。你是否有这样的地方在你的配置?
If <IfModule mod_rewrite.c>
is failing, then you don't have the rewrite module compiled in apache, or it isn't loaded. Do you have this somewhere in your config?
LoadModule rewrite_module modules/mod_rewrite.so
(或者如果有一个条件&LT; IfDefine&GT;
周围,确保定义纳)
(or if there is a conditional <IfDefine>
around it, make sure the define is satisfied)
这篇关于htaccess的方式重写引擎似乎没有工作在我的本地marchine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!