htaccess redirect everything to the index except some folders and files

0

I have this folder structure, and I want to redirect all the requests to my index.php, but ignoring these folders (assets, ajax, testFolder)

index.php
file1.php
file2.php
.htaccess ( im configuring this )
docs
|_doc2
|_doc1
|_.htaccess

assets
|_img
| |_img1.jpg
| |_img2.jpg
|_js
| |_js1.js
| |_js2.js
|_css
  |_css1.css

views
|_file1.php
|_file2.php

ajax
|_file1.php
|_file2.php

testFolder
|_file1.php
|_file2.php
|_.ataccess

I'm trying to use this code but it does not work, the server returns error 500. Could you help me?

RewriteEngine on
RewriteCond %{HTTP_HOST} http://mydomain
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond $1 !^(docs|assets|ajax|testFolder)
RewriteRule ^(.*)$ /index.php [L,R=301]
    
asked by terribleWeb 21.06.2018 в 22:11
source

0 answers