Welcome Guest, Not a member yet? Register   Sign In
Cors php issues
#2

I add this to my root .htaccess file for CORS.

PHP Code:
    # Add Font Types
    AddType application/vnd.ms-fontobject .eot
    AddType application
/x-font-ttf        .ttf
    AddType application
/x-font-opentype   .otf
    AddType application
/font-woff         .woff
    AddType application
/font-woff2        .woff2

    
# Add Image Types
    AddType image/svg+xml .svg .svgz .jpg .png .ico

    
<IfModule mod_headers.c>
        <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg|svgz|jpg|png|ico|font.css|css|js)$">
            ## un-remark this one for all access and remark out the one below it            
            #Header set Access-Control-Allow-Origin "*"
            ## Change this to your local host url. and https or http
            Header add Access-Control-Allow-Origin"https://blog.local"
            Header add Access-Control-Allow-Methods"GET,POST,OPTIONS,DELETE,PUT"
            Header add Access-Control-Allow-Headers"Upgrade-Insecure-Requests"
        </FilesMatch>
    </IfModule>

    # Remove index.php from URL
    RewriteCond %{HTTP:X-Requested-With}    !^XMLHttpRequest$
    RewriteCond %{THE_REQUEST}              ^[^/]*/index\.php [NC]
    RewriteRule ^index\.php(.*)$            $[R=301,NS,L

Read the comments for the headers.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
Cors php issues - by paliz - 04-15-2021, 08:11 AM
RE: Cors php issues - by InsiteFX - 04-15-2021, 08:58 PM
RE: Cors php issues - by paliz - 04-15-2021, 10:12 PM
RE: Cors php issues - by paliz - 04-16-2021, 01:03 PM
RE: Cors php issues - by InsiteFX - 04-16-2021, 08:36 PM
RE: Cors php issues - by paliz - 04-17-2021, 05:46 AM
RE: Cors php issues - by InsiteFX - 04-17-2021, 06:00 AM
RE: Cors php issues - by paliz - 04-17-2021, 06:31 AM
RE: Cors php issues - by paliz - 04-21-2021, 10:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB