网址通过htaccess写

时间:2012-09-13 11:37:08

标签: .htaccess mod-rewrite url-rewriting

我在localhost工作已经在我的网站上写了htaccess

真实网址:

localhost/lite-cms/template/content/index.php?u_title=about-mind-yolk

我添加的htaccess

RewriteRule ^([^/]*)\.html$ /lite-cms/template/content/index.php?id=$1 [L]

我正在获取这样的网址

http://localhost/lite-cms/template/content/about-mind-yolk.html

但我希望这样的网址没有show template / content /

http://localhost/lite-cms/about-mind-yolk.html

请提供解决方案?

1 个答案:

答案 0 :(得分:1)

试试这个(确保htaccess在lite-cms /目录中):

RewriteEngine on
RewriteBase /lite-cms/
RewriteRule ^([^/]*)\.html$ template/content/index.php?u_title=$1 [L]