.htaccess modrewrite没有重定向我的链接

时间:2013-06-21 18:29:09

标签: php .htaccess

我正在将我的网站链接更改为SEO友好网址,我在php文件中做了所有事情并更改了网址如下:

http://mywebsiet.com/news-details.php?id=2012/6/21/newstitle.html

如何重定向到:

http://mywebsiet.com/2012/6/21/newstitle.html

我从www.generateit.net/mod-rewrite /

尝试了这个生成工具

并使用提供的代码创建.htaccess:

RewriteEngine On
RewriteRule ^([^_]*)$ /news-details.php?id=$1 [L]

即便如此,没有任何改变......任何想法?

1 个答案:

答案 0 :(得分:0)

通过httpd.conf启用mod_rewrite和.htaccess,然后将此代码放在.htaccess目录下的DOCUMENT_ROOT中:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^(.+?\.html)$ /news-details.php?id=$1 [L,QSA,NC]
相关问题