【发布时间】:2010-12-24 17:50:46
【问题描述】:
我有这个网址:http://www.test.com/page.php?k=m1ns
我想要这个:http://www.test.com/r/m1ns
我的 .htaccess:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^k/([^/\.]+)/?$ page.php?k=$1 [L]
# force www. in all requests
RewriteCond %{HTTP_HOST} ^test\.com [NC]
RewriteRule ^(.*)$ http://www.test.com/$1 [L,R=301]
# enable hiding php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
但它不起作用。只有非 www -> www 和隐藏 php 规则有效。 如果我把http://www.test.com/page.php?k=m1ns 不重写。
有人知道为什么吗?
谢谢。
【问题讨论】:
标签: .htaccess mod-rewrite