redirect non-index page requests to hash links with .htaccess

后端 未结 1 1658
野性不改
野性不改 2021-01-17 02:05

i\'m weak in regular expressions, i need to redirect any FileName.htm or FileName.html page request to ./#FileName, only i

1条回答
  •  抹茶落季
    2021-01-17 02:39

    Try this rule:

    RewriteCond $1 !=index [NC]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com/ [NC]
    RewriteRule ^([a-zA-Z0-9\-_]+)\.html?$ /#$1 [NE,R]
    

    0 讨论(0)
提交回复
热议问题