.htaccess rewrite to convert forward slash (/) to

2019-09-19 20:17发布

I need a simple rule to rewrite

  • domainn.com/section/page

to

  • domain.com/section-page.html

3条回答
Viruses.
2楼-- · 2019-09-19 20:25
RewriteRule ([^/]+)/([^/]+) $1-$2.html
查看更多
时光不老,我们不散
3楼-- · 2019-09-19 20:30

try this rule:

RewriteEngine on
Options +FollowSymlinks -MultiViews
RewriteRule ^([^/]+)/([^/]+)/?$ /$1-$2.html [R,L]
查看更多
啃猪蹄的小仙女
4楼-- · 2019-09-19 20:37

RewriteEngine On

RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/?$ $1-$2.html [QSA,L]

If you would like to forward your users so the URL shows the change, place R=301 before QSA. R = Redirect, 301 = Permanent.

查看更多
登录 后发表回答