0

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?

1 Answer 1

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 ^(.*)       /
Sign up to request clarification or add additional context in comments.

1 Comment

Nice one thats perfect!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.