How to do a specific condition for escaped_fragment with rewrite rule in .htaccess

做~自己de王妃 提交于 2019-12-24 03:53:07

问题


I have urls like that /#!/page1, I redirect them with :

  RewriteCond %{QUERY_STRING} ^_escaped_fragment_=%2F(.*)$
  RewriteRule ^$ /seo/%1.html [QSA,L]

So /#!/page1 read as /_escaped_fragment_=%2Fpage1 is redirected to /seo/page1.html

It's work perfectly however I want to redirect the home /#!/ to /seo/index.html which actually redirect to /seo/.html

How can I do that? Thanks


回答1:


I fixed it with:

 RewriteCond %{QUERY_STRING} ^_escaped_fragment_=%2F$
 RewriteRule ^$ /seo/index.html [QSA,L]

 RewriteCond %{QUERY_STRING} ^_escaped_fragment_=%2F(.*)$
 RewriteRule ^$ /seo/%1.html [QSA,L]


来源:https://stackoverflow.com/questions/17108931/how-to-do-a-specific-condition-for-escaped-fragment-with-rewrite-rule-in-htacce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!