Modifications needed in .htaccess for cross domain access

You can use the code in this article as a starting point to providing cross domain access.

RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /

# Cross domain access
Header unset Access-Control-Allow-Origin
Header unset Access-Control-Allow-Headers
Header unset Access-Control-Allow-Methods
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "X-Requested-With, Content-Type, Accept, Origin, Authorization, X-Access-Token, X-New-Access-Token"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS, PATCH"

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]Code language: PHP (php)

X-Access-Token, X-New-Access-Token are my application headers.

Source: