htaccess中有多个重写规则


Multiple RewriteRules in htaccess

我无法让我的url重写工作。我必须根除哪种效果好。但我正在尝试添加另一条路线,但它不起作用。

我想要的是:

mydoma.in/

哪个路由到index.php

然后

mydoma.in/comments

哪个路由到带有注释的页面.php

到目前为止,这是我的代码:

# http://httpd.apache.org/docs/current/mod/core.html#errordocument
#ErrorDocument 404 /404.php
ErrorDocument 404 "Message"

RewriteEngine on
RewriteRule ^comment/(.*)$ page-with-comments.php/$1 [L]
<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine on
  RewriteBase /path/needed/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule (.*) index.php/$1 [NC,L]
</IfModule>

两条路线都采用参数。

您的RewriteBase似乎有故障。

在根目录中有这样的代码。htaccess:

<IfModule mod_rewrite.c>
  Options +FollowSymLinks
  RewriteEngine on
  RewriteBase /
  RewriteRule ^comment/(.*)$ page-with-comments.php/$1 [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule (.+) index.php/$1 [L]
</IfModule>