目前,这是我的.htaccess设置
RewriteRule ^buy-things-online plans5.php [NC,L]
当用户转到https://example.com/buy-things-online他们确实看到plans5.php并且页面网址说https://example.com/buy-things-online
时效果很好我的问题是当用户访问真实页面https://example.com/plans5.php时,他们没有被重定向到该页面的新名称(同一文件)
我尝试使用301重定向 这只是一个循环,因为它是相同的文件,浏览器说"太多的重定向"
答案 0 :(得分:0)
You may use these rules in site root .htaccess:
RewriteEngine On
# important to use THE_REQUEST that doesn't change after other rules
RewriteCond %{THE_REQUEST} /plans5\.php [NC]
RewriteRule ^ /buy-things-online [R=301,L]
RewriteRule ^buy-things-online plans5.php [NC,L]