htaccess的干净网址

时间:2011-04-07 07:55:47

标签: .htaccess mod-rewrite

如何转换此网址

http://localhost/cms/index.php?page=register

到这个

http://localhost/cms/page/register.html

请帮助......我在htaccess中表现不佳。

2 个答案:

答案 0 :(得分:2)

尝试使其按照您的意愿运行::)

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} \/cms\/index\.php
RewriteCond %{QUERY_STRING} page\=(.*)
RewriteRule (.*)$ /cms/page/%1.html

如有任何问题,请告诉我...... :)

答案 1 :(得分:0)

试试这个

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^cms/([0-9]+)-([a-z]+) http://localhost/cms/index.php?page=$1-$2 [NC]