.htaccess config with symbolic links and index files not working as expected

后端 未结 2 2027
梦如初夏
梦如初夏 2021-02-19 06:57

Like a lot of web developers, I like to use .htaccess to direct all traffic to a domain through a single point of entry when the request isn\'t for a file that exists in the pub

2条回答
  •  醉酒成梦
    2021-02-19 07:39

    Use the -l switch to test for a symbolic link

    RewriteEngine On
    # enable symbolic links
    Options +FollowSymLinks
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^(.+) index.php [L]
    

    Documentation

    http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html - ctrl+f for "Treats the TestString as a pathname and tests whether or not it exists, and is a symbolic link."

提交回复
热议问题