wazzaday
wazzaday

Reputation: 9664

writing htaccess redirect for angular html5 mode

I have the following htaccess to work with routing back to the base url '/' for angulars html5mode

RewriteEngine On
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)       /

But I have a folder called '/api' which contains php files which i need to use as a rest API.

With the following in the htaccess all requests to this get redirected back to the base. how can I ignore php files or this folder?

Upvotes: 0

Views: 190

Answers (1)

If api is a folder add there .htaccess file with:

RewriteEngine Off

Else:

RewriteEngine On
   RewriteBase /
   RewriteCond %{REQUEST_URI} !^/?(api)/
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)       /

Upvotes: 1

Related Questions