Home  >  Q&A  >  body text

Apache rewrite rule problem?

1 hi, I want to implement the following rules:
All requests are directed to index.php
All resources (pictures, css, etc.) are directly accessed

How should I write my .htaccess? ? ? ?

滿天的星座滿天的星座2713 days ago539

reply all(1)I'll reply

  • 世界只因有你

    世界只因有你2017-05-16 17:02:57

    <IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^(.*)$ index.php [QSA,PT,L]
    </IfModule>
    1. Cond is like this. If the file or folder exists, access it directly.

    2. OK, if it does not exist, rewrite the Rules and point them all to index.php

    reply
    0
  • Cancelreply