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

后端 未结 2 2017
梦如初夏
梦如初夏 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:32

    The -l flag references symbolic links

    RewriteEngine On
    # enable symbolic links
    Options +FollowSymLinks
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^(.+) index.php [L]
    
    0 讨论(0)
  • 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."

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