【发布时间】:2014-04-16 10:47:03
【问题描述】:
我创建了.htaccess,内容为:
Options +FollowSymLinks
IndexIgnore */*
# Turn on the RewriteEngine
RewriteEngine On
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
所以,我期待:http://mydomain.com/command/paramater1 被定向到 index.php,但不会发生这种情况,而是出现 404 错误。
但是,http://mydomain.com 将打开 index.php
我的网站目录是这样的:
public_html/index.php public_html/.htaccess
我启用了mod_rewrite。
有什么想法吗?
编辑
当http://mydomain.com/command/paramater1 时我期待的是读取 index.php 中 url 中的命令并采取相应措施,但正如我所提到的,index.php 没有打开,而是 404 错误
【问题讨论】:
-
你想重写所有的索引吗?使用
^而不是. -
您能否通过添加此问题的答案来编写正确的 .htaccess 文件?谢谢
-
您在 Apache 服务器上? Windows 服务器会忽略 .htaccess,除非你有某种特殊的插件,而且我不认为 nginx 使用相同的格式。
-
是的,我在 Apache 服务器上,而不是 windows...
标签: php .htaccess mod-rewrite routes