【发布时间】:2017-01-23 12:48:45
【问题描述】:
我正在尝试在我的 .htaccess 中使用 mod_rewrite 但不起作用。
我的网址是http://gestor.samfbas.com.br/index.php?p=something 应该是http://gestor.samfbas.com.br/something
该文件位于我主机的子目录(gestor)中,所有文件都在其中。
<IfModule mod_rewrite.c>
Options +FollowSymLinks +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?$ /index.php?p=$1 [L]
</IfModule>
【问题讨论】:
-
请添加更多信息,我很难找出问题所在。
-
my url is是什么意思?你把它放在你的html页面上了吗?而这个http://gestor.samfbas.com.br/index.php?p=something将不会被重定向,因为RewriteCond %{REQUEST_FILENAME} !-f的条件在这里失败,而这个http://gestor.samfbas.com.br/something似乎正在工作 -
阅读:我可以看到你的目录gestor.samfbas.com.br/scripts保护你的服务器删除
Options +Indexes -
@JustOnUnderMillions 我删除了它,谢谢!
-
@JustOnUnderMillions 我的主页是gestor.samfbas.com.br/index.php。当我重定向到某个页面时,我使用条件 ?p=something 但我的 url 不会重写为 /something。
标签: php html .htaccess mod-rewrite