Apache RewriteMap Used to Prevent Direct Access to Files [closed]

▼魔方 西西 提交于 2019-12-05 09:46:46

Here's how I do (you may think it's a lot of instructions, but it's sooo quick compared to PHP handling that you should not worry about 5 (or something) cond instead of 2 (or something)):

RewriteEngine On
RewriteCond %{HTTP_COOKIE} my_cookie=([^;]+) [NC]
# Don't touch anything but create MYCOOKIE environment
# and set it to empty if not found:
RewriteRule . - [E=MYCOOKIE:${my_rewrite_map_func:%{TIME}%1|}]
# If the environment was found = not empty:
RewriteCond %{E:MYCOOKIE} !^$ [NC]
# ... then process a rewrite rule:
RewriteRule [blabla...blabla]

I do some stuff like that 50 times and my web server is still amazingly fast. (the bottleneck is the database)

Hope this helps

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