A question about pseudo-static, suddenly forget a piece of code

Source: Internet
Author: User
A question about pseudo-static, suddenly forget a piece of code
I want to achieve such an effect: When the index.html exists, the access to the existence of the index.html file, does not exist, the pseudo-static to go through dynamic access, configured as follows:



Rewriteengine on

Rewritecond%{http_host} ^ (. *) www.aaa.com$ [OR]
Rewritecond%{http_host} ^ ([^www]*). aaa.com$
Rewritecond%{document_root}%{request_filename}!-f
Rewriterule ^ (. *) $ http://www.aaa.com.$1 [r,qsa,l]

Rewriterule ^/([a-za-z]+) \.html$/run.php?controller=$1&action=$1&default=1 [L]

ServerAdmin [email protected]
DocumentRoot "E:/www/home"
ServerName www.aaa.com
Errorlog "D:/appserv/log/index_error.log"
Customlog "D:/appserv/log/index_access.log" common
ErrorDocument 404 http://www.aaa.com/error_404.html
ErrorDocument 403 http://www.aaa.com/error_403.html


Options Indexes FollowSymLinks
DirectoryIndex index.html
AllowOverride None
Order Deny,allow
Allow from all





But the above configuration has a problem, when the index.html exist, the system also through pseudo-static access, help.
I am sure that the effect I am going to do is achievable, I have done this before, and then I lost my configuration, and I can't think of what I wrote wrong.
Help, thank you.


------Solution--------------------
#如果目录存在就直接访问目录不进行RewriteRule
Rewritecond%{request_filename}!-d

#如果文件存在, the file is accessed directly without the following rewriterule. (Do not overwrite if file or file does not exist)
Rewritecond%{request_filename}!-f

------Solution--------------------
Learn ...
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.