如何更改此url
http://domain.com/search/song
至
http://domain.com/search/song.html
.htaccess文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php?/$1 [QSA,L]
尝试添加字符串
RewriteRule ^(/search/song)$ $1.html [L,R=301]
RewriteEngine On
之后
如果这不起作用,试着把这个:
RedirectMatch 301 ^(/search/song)$ $1.html
这应该非常有效。