如何在htaccess中为我的需求编写重写规则?

时间:2012-10-10 09:40:17

标签: apache .htaccess

以下是我正在使用的htaccess代码。

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^admin/([a-z_]+)/?$ admin/index.php?m=$1 [QSA,L]

RewriteRule ^admin/?$ admin/index.php [L]

RewriteRule ^category$ category.php [L]

RewriteRule ^([a-zA-Z0-9_\-]+)$ /user.php?username=$1 [L]

</IfModule>

当有人访问网址时:http://www.mydomain.com/category,应将其重定向到http://www.mydomain.com/category.php。但是上面的代码不符合我的要求。

以上代码中的以下代码对我不起作用。

RewriteRule ^category$ category.php [L]

我该怎么做才能让它发挥作用?

请指导我。提前谢谢。

0 个答案:

没有答案