mod_rewrite exception for a specific file

前端 未结 2 1142
余生分开走
余生分开走 2021-02-06 04:19

My page is not redirecting as it should due to my .htaccess file which is set as:

RewriteEngine on  
RewriteCond $1 !^(index\\.php|resources|robots\\.txt)  
Rewr         


        
2条回答
  •  失恋的感觉
    2021-02-06 04:44

    Try with this:

    RewriteEngine on  
    RewriteCond $1 !^(index\.php|forum|resources|robots\.txt)  
    RewriteCond %{REQUEST_FILENAME} !-f  
    RewriteCond %{REQUEST_FILENAME} !-d  
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]   
    

    And this:

    # BEGIN PunBB
    
    # ----------------------------------------------------------------------
    # Start rewrite engine
    # ----------------------------------------------------------------------
    
    
        # MultiViews interfers with proper rewriting
        Options -MultiViews
    
        RewriteEngine On
    
        # Uncomment and properly set the RewriteBase if the rewrite rules are not working properly
        RewriteBase /forum/
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . rewrite.php [L]
    
    
    
    # ----------------------------------------------------------------------
    # Better website experience for IE users
    # ----------------------------------------------------------------------
    
    # Force the latest IE version, in various cases when it may fall back to IE7 mode
    # github.com/rails/rails/commit/123eb25#commitcomment-118920
    # Use ChromeFrame if it's installed for a better experience for the poor IE folk
    
    
        
            BrowserMatch MSIE ie
            Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
        
    
    
    
        # Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
        # We need to inform proxies that content changes based on UA
        Header append Vary User-Agent
        # Cache control is set only if mod_headers is enabled, so that's unncessary to declare
    
    
    
    # ----------------------------------------------------------------------
    # UTF-8 encoding
    # ----------------------------------------------------------------------
    
    # Use UTF-8 encoding for anything served text/plain or text/html
    AddDefaultCharset utf-8
    
    # Force UTF-8 for a number of file formats
    AddCharset utf-8 .html .css .js .xml .json .rss
    
    
    # ----------------------------------------------------------------------
    # A little more security
    # ----------------------------------------------------------------------
    
    # Do we want to advertise the exact version number of Apache we're running?
    # Probably not.
    ## This can only be enabled if used in httpd.conf - It will not work in .htaccess
    # ServerTokens Prod
    
    
    # "-Indexes" will have Apache block users from browsing folders without a default document
    # Usually you should leave this activated, because you shouldn't allow everybody to surf through
    # every folder on your server (which includes rather private places like CMS system folders).
    
        Options -Indexes
    
    
    # END PunBB
    

提交回复
热议问题