Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

route everything to index.php except one directory using FallbackResource

I have used FallbackResource /index.php in htaccess to re-route every call to index.php

it works very fine and I am getting the result that I wanted, but I need one directory to access and that directory also re-routes to index.php. How can I achieve this.

like image 611
Syed Rizwan Ali Avatar asked Oct 19 '25 04:10

Syed Rizwan Ali


2 Answers

For disable routing fallback inside one directory use disabled keyord (Apache 2.4.4 and later).

  <Directory /var/www/path/to/disabled/dir>
        FallbackResource disabled
  </Directory> 

In case of .htaccess files use FallbackResource disabled inside this dir.

like image 80
vatavale Avatar answered Oct 22 '25 03:10

vatavale


FallbackResource doesn't support exclusions like this. You can use mod_rewrite as an alternative.

You can use this rule in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^exclude index.php [L,NC]
like image 39
anubhava Avatar answered Oct 22 '25 04:10

anubhava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!