我试图从当前网址显示为
的网址中删除?http://www.tenantfind.co.uk/blog-detail.php?id=4
它应该以
打开http://www.tenantfind.co.uk/blog/new-legal-helpline
我尝试了以下解决方案
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(blog-detail)?\?([^&\ ]+)
RewriteRule ^ /%1? [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog-detail?$1 [L]
但它会重定向到以下链接并显示空白页面,页面上没有数据
http://www.tenantfind.co.uk/blog-detail
答案 0 :(得分:1)
尝试:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(?:blog-detail)?\?([^&\ ]+)
RewriteRule ^ /blog/%1? [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/(.*)/?$ /blog-detail?$1 [L]