Deharlan
Deharlan

Reputation: 32

custom conditions in htaccess

I need to create an htaccess file, that when a person is ANY file access (like this "home / conf.php") or url (like this "/ home / asdasda") is redirected to / index.php, with the exception of a folder called "/ uploads".

That's because I do not want anyone to have access to any file from my site, and that all possible paths are taken to index.php.

I've tried everything and there's always something that did not work.

Upvotes: 0

Views: 60

Answers (1)

anubhava
anubhava

Reputation: 785156

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

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !(/index\.php|/uploads/) [NC]
RewriteRule ^ index.php [L]

Upvotes: 2

Related Questions